Using beeline, you can give specific hive commands (not HQL queries !) for hive configuration such as:
add jar myjar.jar
However, I do not understand how you can provide these commands to beeline without being in interactive mode as the documentation does not (or I do not find it) specify how to do it.
I have tried to provide it with the query argument -e
, but no success:
beeline \
-u toto \
-n toto\
-p toto \
--silent=true \
-e "add jar hivexmlserde-1.0.5.3.jar; show databases;"
Error: AnalysisException: Syntax error in line 1:
add jar hivexmlserde-1.0.5.3.jar; show databases
^
Encountered: ADD
I have tried to do something like this, but it does not seem to do anything:
beeline \
-u toto \
-n toto\
-p toto\
--silent=true \
-e "show databases;" <<EOF
add jar hivexmlserde-1.0.5.3.jar
list jar
EOF
Which does not provide any log about adding a jar to the distributed cache.
How can I give to beeline some beeline commands before executing the provided HQL queries ?
Not sure why you are trying to add jar using beeline. You can easily do using hive shell.
hadoop fs -put ~/Downloads/hive.jar /lib/
add jar hdfs:///lib/hive.jar
Now, if you want to issue a SQL command, you can use
-q
in beeline.I think for beeline -
-u
require to give DB url. Something like this