Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> Variable resolution Fails


Copy link to this message
-
Variable resolution Fails
Hi,
 
The following variable freq fails to resolve:
 
bash-4.1$ export freq=MNTH
bash-4.1$ echo $freq
MNTH
bash-4.1$ hive -e "select ${env:freq} as dr  from dual"
Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties
Hive history file=/hadoop1/hive_querylog/sumighos/hive_job_log_sumighos_201304302321_1867815625.txt
FAILED: ParseException line 1:8 cannot recognize input near 'as' 'dr' 'from' in select clause
bash-4.1$

Here dual is a table with 1 row.
What am I am doing wrong? When I try to resolve freq - it is empty!!
 
  $ hive -S -e "select '${env:freq}' as dr  from dual"
 
  $
 
Thanks,
Sumit
+
Anthony Urso 2013-05-01, 02:20
+
Sanjay Subramanian 2013-05-01, 02:44
+
Naidu MS 2013-05-01, 07:53
+
Nitin Pawar 2013-05-01, 08:23
+
Ted Yu 2013-05-01, 08:50
+
sumit ghosh 2013-05-01, 18:48
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB