Member since
11-08-2021
2
Posts
0
Kudos Received
0
Solutions
01-19-2022
02:01 AM
Hi, beeline -e "query_string". the query string can contain multiple queries. Those queries will be executed sequentially. In these case once loadTable1.hql completed after that loadTable2.hql will start. One Solution - Merge both the file as a single file and execute the target HQL by replacing hive variables like below, [hive@node~]$ cat loadTable1.hql loadTable2.hql
#HQL file 1
select * from sample1 where rownum between ${hivevar:FROM} and ${hivevar:TO};
#HQL file 2
select * from sample2 where rownum between ${hivevar:FROM} and ${hivevar:TO};
[hive@node~]$ cat loadTable1.hql loadTable2.hql > target.hql
[hive@node ~]$ beeline -u "${jdbc_url}" --hivevar FROM=10 --hivevar TO=30 -f target.hql
0: jdbc:hive2> #HQL file 1
0: jdbc:hive2> select * from sample1 where rownum between ${hivevar:FROM} and ${hivevar:TO};
DEBUG : Acquired the compile lock.
INFO : Compiling command(queryId=hive_20220119094048_055b8d53-a101-453f-902b-3b08b6ffd4d3): select * from sample1 where rownum between 10 and 30
.
.
.
0: jdbc:hive2> #HQL file 2
0: jdbc:hive2> select * from sample2 where rownum between ${hivevar:FROM} and ${hivevar:TO};
DEBUG : Acquired the compile lock.
INFO : Compiling command(queryId=hive_20220119094048_9271ad34-64d1-424b-ad09-f3ca8cf630f9): select * from sample2 where rownum between 10 and 30
.
.
.
... View more