Use "from_unixtime(unix_timestamp())". This might help you to get what you
want.
You may have to split date and time because this function will returns
TIMESTAMP.

On Tue, Jun 2, 2015 at 7:49 PM, Ayazur Rehman <rehman.ayazu...@gmail.com>
wrote:

> 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
>
>

Reply via email to