How to pass external date parameter in hive hql

0 votes
How to pass external date parameter in hive hql
Jul 26 by anonymous
• 120 points
36 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 by Rishi
0 votes

You can try this:

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

answered Jul 26 by Megha

Related Questions

0 votes
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,510 points
2,408 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,510 points
246 views
0 votes
10 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
12,237 views
0 votes
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,240 points
898 views
0 votes
1 answer
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,510 points
268 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,700 points
27 views
0 votes
1 answer