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
相关文章
相关标签/搜索