Re: List of dates as arguments

2014-08-24 Thread Nitin Pawar
with your shell script calculate your start date and end date hive $HIVEPARAMS -hiveconf startdate=$var1 -hiveconf enddate=$var2 also set in ..hiverc set hive.variable.substitute=true; On Sun, Aug 24, 2014 at 10:19 AM, karthik Srivasthava karthiksrivasth...@gmail.com wrote: As my raw-data

Re: List of dates as arguments

2014-08-24 Thread Teja Kunapareddy
Thanks Nithin For your reply.. I can get start date and end date,. But can i get all the dates with in START DATE AND END DATE.??? . so that my query looks something like this Select a, b, c from table_x where date in (${hiveconf:LIST_OF DATES}) On 24 August 2014 01:18, Nitin Pawar

Re: List of dates as arguments

2014-08-24 Thread karthik Srivasthava
Nitin, Teja Thank you.. I exactly need what Teja suggested... i need list of dates between start date and end date On Sun, Aug 24, 2014 at 2:05 AM, Teja Kunapareddy tejakunapare...@gmail.com wrote: Thanks Nithin For your reply.. I can get start date and end date,. But can i get all the

Re: List of dates as arguments

2014-08-24 Thread Nitin Pawar
I am not sure if you can transform array from shell to java, you may want to write your own custom UDF for that if these are continuous dates, then you can have less than greater than comparison On Sun, Aug 24, 2014 at 12:39 PM, karthik Srivasthava karthiksrivasth...@gmail.com wrote: Nitin,

Re: List of dates as arguments

2014-08-24 Thread Bala Krishna Gangisetty
Here is my understanding on your requirements. Let me know if I am missing something. You, a) would like to run a query daily to find top 10 products in the past 15 days b) would like to pass dates dynamically as arguments to HIVE query Given the requirement a), passing just two

Re: List of dates as arguments

2014-08-24 Thread Nitin Pawar
Bala, I think they need an array substitution instead of string as hiveconf variable substitution On Sun, Aug 24, 2014 at 11:55 PM, Bala Krishna Gangisetty b...@altiscale.com wrote: Here is my understanding on your requirements. Let me know if I am missing something. You, a) would like

Re: List of dates as arguments

2014-08-24 Thread Bala Krishna Gangisetty
The query can be modified further with one variable with the of date_sub() UDF function, available by default. Suppose currentdate is the argument whose value is current date, the query will look like: SELECT * FROM *table_name* WHERE *date_column* BETWEEN date_sub(*${hiveconf:currentdate}, 15)*

Re: List of dates as arguments

2014-08-24 Thread Bala Krishna Gangisetty
Nitin: Given the requirement, I don't think it's required to pass array of dates to HIVE query. On Sun, Aug 24, 2014 at 11:56 AM, Bala Krishna Gangisetty b...@altiscale.com wrote: The query can be modified further with one variable with the of date_sub() UDF function, available by default.

Re: List of dates as arguments

2014-08-24 Thread karthik Srivasthava
Bala Krishna Gangisetty and Nithin, Thanks for your response.. Your response was very helpful.. But date datatype being STRING, will it encourage this query ?? SELECT * FROM *table_name* WHERE *date_column* BETWEEN date_sub(*${hiveconf:currentdate}, 15)* AND *${hiveconf:currentdate}* *I am

Re: List of dates as arguments

2014-08-24 Thread karthik Srivasthava
Yes.. Its working On Sun, Aug 24, 2014 at 2:31 PM, Bala Krishna Gangisetty b...@altiscale.com wrote: Yes, it does. Did you enclose the currentdate value in ' ', or ? On Sun, Aug 24, 2014 at 12:22 PM, karthik Srivasthava karthiksrivasth...@gmail.com wrote: Bala Krishna Gangisetty and

List of dates as arguments

2014-08-23 Thread karthik Srivasthava
As my raw-data table is partitioned by date.. i want to get data to run a query every days to find top 10 products in last 15 days . How to pass list of dates dynamically as arguments in hive query using hiveconf?