hive执行sql文件(以引用的方式)

创建脚本test1.sql

drop table if exists test.test_cj1;
create table test.test_cj1(id int);

创建脚本test2.sql

drop table if exists test.test_cj2;
create table test.test_cj2(id int);

创建总脚本all.sql,引用test1.sql和脚本test2.sql

source test1.sql;

source test2.sql;

drop table if exists test.test_cj3;
create table test.test_cj3(id int);

执行总脚本

hive -f all.sql

转载于:https://my.oschina.net/huhaicool/blog/2992333