hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayazur Rehman <rehman.ayazu...@gmail.com>
Subject current_date function in hive
Date Tue, 02 Jun 2015 14:19:29 GMT
Hi everyone,

I am trying to schedule a hive query using Oozie, to perform aggregation on
a table on data of a particular day and save the results in another table
whenever every 24 hours.

the schema of my table is something like (tablename - currenttable)
id                      string
cdatetime               timestamp
average                 int
locations               array<string>
color                   string

And currently the query that I perform manually everyday is something like

insert into table lotable select id, lv, cdatetime, color, count(color)
from currenttable lateral view explode(locations) lvtable as lv where
to_date(cdatetime)='2015-06-01' group by cdatetime, color, lv, id;

So, in order to automate the process I want to use a date function that
would let hive aggregate on the data of the previous day.
I tried using current_date function but I can't get the syntax right. I get
the following error
              FAILED: SemanticException [Error 10011]: Line 1:47 Invalid
function 'current_date'

Could you please help me with the syntax.


-- 
Thanking You,
Ayaz

Mime
View raw message