Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> What's wrong with this query?


Copy link to this message
-
Re: What's wrong with this query?
to_date(from_unixtime(cast(timestamps as int)))

On Tue, Jul 10, 2012 at 1:33 PM, Raihan Jamal <[EMAIL PROTECTED]> wrote:
> I need only the date not the hours and second, so that is the reason I was
> using to_date and from_unxitime() take int as parameter and timestamps is a
> string in this case.
>
>
>
>
> Raihan Jamal
>
>
>
> On Tue, Jul 10, 2012 at 1:28 PM, Vijay <[EMAIL PROTECTED]> wrote:
>>
>> You need to use from_unixtime()
>>
>> On Tue, Jul 10, 2012 at 1:01 PM, Raihan Jamal <[EMAIL PROTECTED]>
>> wrote:
>> > Here timestamps is a string and I always get NULL in the second column
>> > when
>> > I try to get date out of the timestamp. Anything wrong I am doing?
>> >
>> >
>> > select A.timestamps, to_date(A.timestamps) from
>> > (select user_id, prod_and_ts.product_id as product_id,
>> > prod_and_ts.timestamps as timestamps from testingtable2 lateral view
>> > explode(purchased_item) exploded_table as prod_and_ts) A;
>> >
>> >
>> > This is the Output I am getting always.
>> >
>> > 1004941621      NULL
>> > 1005268799      NULL
>> > 1061569397      NULL
>> > 1005542471      NULL
>> >
>> >
>> >
>> > Raihan Jamal
>> >
>
>