Created 02-18-2016 11:59 AM
I am trying to pass a WHERE
condition as a variable to hive hql via BeeLine.
--hivevar somekey1='"someValue"'
works well
--hivevar somekey2='"colum1<=someValue"'
does not work which prints the Beeline usage. How can I escape equal to (=)?
Any help or pointers on how I can solve this issue?
Created 02-18-2016 07:44 PM
You can normally escape things with a \ in front of it. Sometimes two backslash.
Created 02-22-2016 05:29 AM
Created 02-22-2016 05:52 AM
I hope this may help
SELECT packets.sourceip FROM packets WHERE packets.destip = "${hivevar:DEST_IP}" AND packets.hour = ${hivevar:HOUR} GROUP BY packets.sourceip link
Created 02-22-2016 08:51 AM
Ok just tried it out. Your problem is that you didn't use the double quotes on the outside. The linux command line needs double quotes to escape strings. You can use single quotes inside.
[root@sandbox ~]# more test.sql
select * from sample_07 where ${cond};
[root@sandbox ~]# beeline -u jdbc:hive2://sandbox:10000/default -f test.sql --hivevar cond="description='All Occupations'"
...
+-----------------+------------------------+----------------------+-------------------+--+
| sample_07.code | sample_07.description | sample_07.total_emp | sample_07.salary |
+-----------------+------------------------+----------------------+-------------------+--+
| 00-0000 | All Occupations | 134354250 | 40690 |
+-----------------+------------------------+----------------------+-------------------+--+
Created 02-22-2016 10:58 AM
Hi all,
I am having the below senario, where the values in where clause is dynamic.
beeline -u jdbc:hive2://<#####>/;auth=noSasl --silent=true --hivevar where_condition=" where modifyts >= '2016-02-18 00:55:43.00' and modifyts < '2016-02-18 00:55:44.0'" --hiveconf hive.auto.convert.join=false --hiveconf hive.optimize.skewjoin=true --hivevar destination_hive_table_name=<table> -f insert_delta_data.hql
22-02-2016 02:51:05 PST beeline_insert_into_k_gvt_inv_node_cntrl_tbl
INFO - Usage: java org.apache.hive.cli.beeline.BeeLine 22-02-2016 02:51:05 PST
beeline_xxxxx INFO - -u the JDBC URL to connect to 22-02-2016 02:51:05 PST
beeline_xxxxx INFO - -n the username to connect as 22-02-2016 02:51:05 PST
beeline_xxxxxNFO - -p the password to connect as 22-02-2016 02:51:05 PST ......................