How to pass external date parameter in hive hql

0 votes
How to pass external date parameter in hive hql
Jul 26, 2019 by anonymous
• 120 points
541 views

2 answers to this question.

0 votes

You can pass the external date from a file to HQL. You can either manually store the date in a file or use a command like this:

$ date> date.txt

Then you have to pass this date.txt file which has the date, as the parameter to HQL. You can do it with the following syntax:

$ hive <path to hql file> -i <path to date.txt file>

Example:

$ hive "/home/user/sample.hql" -i "/home/user/date.txt"
answered Jul 26, 2019 by Rishi
0 votes

You can try this:

 hive -hiveconf dt=current_date -e 'select ${hiveconf:dt;'

answered Jul 26, 2019 by Megha

Related Questions

+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
5,096 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
728 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
30,245 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,310 points
1,902 views
0 votes
1 answer

How to pass parameter through testng.xml file to a test case in Selenium Webdriver?

Hello Revathi, to pass parameter through testng.xml ...READ MORE

answered Jun 12, 2019 in Selenium by Abha
• 27,920 points
2,035 views
+2 votes
0 answers
0 votes
1 answer

How Impala is fast compared to Hive in terms of query response?

Impala provides faster response as it uses MPP(massively ...READ MORE

answered Mar 21, 2018 in Big Data Hadoop by nitinrawat895
• 10,920 points
565 views
0 votes
1 answer

How to change mulitiple characters in a column to a date

Firstly we have to set dataf variable ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points
63 views
0 votes
1 answer