shell语句执行hive查询

[size=large][b]执行hive查询实例[/b][/size]
[b]执行select查询[/b]
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a'

[b]加入配置变量的查询[/b]
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a' -hiveconf  hive.exec.scratchdir=/home/my/hive_scratch  -hiveconf mapred.reduce.tasks=32

[b]查询结果输出为文本[/b]
$HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt

[b]执行sql语句文件[/b]
$HIVE_HOME/bin/hive -f /home/my/hive-script.sql

[b]不打印执行进度[/b]
hive -S -f /home/usr/my.sql

你可能感兴趣的:(hive,linux,hive,shell,sql)