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
2,542 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
• 11,380 points
8,049 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
• 11,380 points
1,371 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
67,110 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,390 points
3,062 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
• 28,060 points
4,890 views
0 votes
1 answer

How to pass an array as a function parameter in JavaScript?

Hello @kartik, Use: const args = ['p0', 'p1', 'p2']; call_me.apply(this, ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
254 views
0 votes
1 answer

How to Pass route control with optional parameter after root in express?

Hello @kartik, That would work depending on what ...READ MORE

answered Oct 12, 2020 in Node-js by Niroj
• 82,880 points
3,413 views
0 votes
1 answer

How can I pass parameter from Route to Filter in laravel?

Hii, Filters can be passed parameters, like the ...READ MORE

answered Dec 4, 2020 in Laravel by Niroj
• 82,880 points
864 views
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
• 11,380 points
1,008 views