1. 从文件中执行hql语句
hive -f test.hql;
2. 在hive shell中使用source执行脚本
source test.hql;
注:hive执行语句的文件通常使用.hql或.q为后缀名,但不是必须的。