1. 程式人生 > >shell語句執行hive查詢

shell語句執行hive查詢

執行hive查詢例項

執行select查詢

$HIVE_HOME/bin/hive -e 'select a.col from tab1 a'

加入配置變數的查詢

$HIVE_HOME/bin/hive -e 'select a.col from tab1 a' -hiveconf hive.exec.scratchdir=/home/my/hive_scratch  -hiveconf mapred.reduce.tasks=32

查詢結果輸出為文字

 $HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt

執行sql語句檔案

$HIVE_HOME/bin/hive -f /home/my/hive-script.sql