Support Questions

Find answers, ask questions, and share your expertise

how to run .hql scripts from beeline prompt

avatar
Contributor

Hi ,

Can you give me the steps for running the .hql scripts from beeline prompt?

i get below error.

0: jdbc:hive2://> source /home/local/hive/p.hql;

NoViableAltException(26@[])

at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1079)

at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)

at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)

****************

i am comfortable with below command and it works

1) hive> source /home/local/hive/p.hql;

OK

table_1

table_2

Time taken: 0.231 seconds, Fetched: 2 row(s)

hive>

2) beeline -u jdbc:hive2://xxxxxxxxxx:10000/default -n hive -p hive -f /home/local/hive/st.hql >> out.txt

3) $HIVE_HOME/bin/hive -f /home/local/hive/st.hql --database default > out.txt

1 ACCEPTED SOLUTION

avatar
Super Collaborator

@Jacqualin jasmin

Please try this from within beeline client:

 0 jdbc:hive2://> !run /tmp/test.hql

The file does not need to be local to the Hiveserver2, it needs to exist on the node where you run Beeline.

check:

 0 jdbc:hive2://> !help

too, for many usefull special commands in Beeline

View solution in original post

1 REPLY 1

avatar
Super Collaborator

@Jacqualin jasmin

Please try this from within beeline client:

 0 jdbc:hive2://> !run /tmp/test.hql

The file does not need to be local to the Hiveserver2, it needs to exist on the node where you run Beeline.

check:

 0 jdbc:hive2://> !help

too, for many usefull special commands in Beeline