hive學習之腳本化運行

第一種方式:使用hive -e "sql"sql

hive -e "select count(1) from default.hive_test"

第二種方式:使用shell腳本shell

#建立test.sh文件
vi test.sh
#編寫腳本
#!/bin/bash
hive -e "select * from default.hive_test"
#運行腳本
sh test.sh

第三種方式:使用hive -f hql文件(推薦)bash

#建立hql文件
vi test.hql
#編寫sql
select* from default.hive_test;
#運行
hive -f test.hql
相關文章
相關標籤/搜索