Support Questions
Find answers, ask questions, and share your expertise

Beeline Configuration hiveconf Equivalent

Contributor

Need to set hive configuration options from Beeline CLI command. The below code, for example, doesn't work.

--hiveconf hive.execution.engine=tez

--hiveconf and --property-file both don't appear to be making the session take the settings.

Here it is in full usage:

beeline -n $user -p $password -u "$jdbc_url" -f $script --verbose true --property-file "query.properties" --fastConnect

Is the only way to make it work to include the options in the JDBC URL as arguments? Like hive.execution.engine=tez;next;next ?

7 REPLIES 7

Re: Beeline Configuration hiveconf Equivalent

Super Guru

you can use set hive.execution.engine=tez; while in a session or beeline --hiveconf hive.execution.engine=tez should work. what version of hive are you using? Are you setting any other value for --hiveconf?

Another option is the sel set hive.execution.engine=tez; inside your hive script or have --hivevar has parameter into your hive script to set execution engine

beeline -u jdbc:hive2://hostname:10000 -n xxxx -p xxxx -f /home/hdfs/scripts/hive/myscript.hql --hivevar engine=tez

Then use ${engine} variable inside your script.

Re: Beeline Configuration hiveconf Equivalent

Contributor

Using a set works fine, correct. However, that requires that I do that for every script I try to automate. My goal is to make these values a default part of this base command, and just change what SQL I throw at it. Global values, if you will.

This should be remedied by the use of --hiveconf or --property-file, but neither results in it taking the values. Here's an example:

Command:

beeline -n $user -p $password -u "$jdbc_url" -f $script --verbose true --property-file "query.properties" --fastConnect

query.properties

hive.execution.engine=tez;
tez.queue.name=di;
hive.exec.parallel=true;

The job shows up in the 'default' queue when it should show up in the 'di' queue. When I use a set command, it does in fact show up in the 'di' queue.

Re: Beeline Configuration hiveconf Equivalent

Super Guru

what version of hive are you using?

Re: Beeline Configuration hiveconf Equivalent

Contributor

Hive-Hcatalog 1.2.1

Re: Beeline Configuration hiveconf Equivalent

Super Guru

I just tried --hiveconf and it did not set the execution engine. Digging why it didn't take.

Re: Beeline Configuration hiveconf Equivalent

Super Guru

I got it working now. Here is what I did

[LAKE] [smanjee@lake1 ~]# beeline -u "jdbc:hive2://example.com:2181,example.com:2181,example:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" --hiveconf hive.execution.engine=mr

and it worked. I was missing the " " around the jdbc

0: jdbc:hive2://example.com:2> set hive.execution.engine;
+---------------------------+--+
|            set            |
+---------------------------+--+
| hive.execution.engine=mr  |
+---------------------------+--+
1 row selected (0.192 seconds)
0: jdbc:hive2://example.com:2>

Re: Beeline Configuration hiveconf Equivalent

Contributor

WORKING WORKAROUND:

Set the options in your JDBC URL. So your URL goes from this...

Old:

jdbc:hive2://hadoop.company.com:8443/default;transportMode=http;httpPath=gateway/default/hive

New:

jdbc:hive2://hadoop.company.com:8443/default;transportMode=http;httpPath=gateway/default/hive?hive.execution.engine=tez;tez.queue.name=di;hive.exec.parallel=true;hive.vectorized.execution.enabled=true;hive.vectorized.execution.reduce.enabled