简体   繁体   中英

Execute HQL file with beeline command

i'm trying to execute a query in a test.hql with beeline and i'm not getting results

here the command:

beeline -u "jdbc:hive2://master01:2181,master02:2181,master03:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" -f test.hql

in test.hql file:

select * from db1.tab1 limit 20;

But if i execute the command with the parameter -e which execute directly the query,it gives me the results

beeline -u "jdbc:hive2://master01:2181,master02:2181,master03:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" -e "select * from db1.tab1 limit 20;"

Am i missing something?

You're right. -e is used to execute one or multiple queries and see the result.

-f is mostly used to run scripts like insert into mytab select * from ourtab; where you dont need to see all the rows.

For more options you can check- https://cwiki.apache.org/confluence/display/hive/hiveserver2+clients#HiveServer2Clients-BeelineHiveCommands

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM