hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arijit Banerjee (JIRA)" <>
Subject [jira] [Commented] (HIVE-3454) Problem with CAST(BIGINT as TIMESTAMP)
Date Tue, 18 Jun 2013 03:07:21 GMT


Arijit Banerjee commented on HIVE-3454:

I think a good approach would be to fix it in a way that it can work with both double and
long values. This is what I did and works for me. Let me know what you think.

In org.apache.hadoop.hive.serde2.objectinspector.primitive
edit getTimestamp method and convert the long object to double.

getTimestamp(Object o, PrimitiveObjectInspector oi) 

case LONG:
      //Timestamp conversion from LONG is messy. Converting to double.
      long tsLongPrimitive=((LongObjectInspector) oi).get(o);
      result =TimestampWritable.doubleToTimestamp(tsLongPrimitive*1.0);
> Problem with CAST(BIGINT as TIMESTAMP)
> --------------------------------------
>                 Key: HIVE-3454
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Types, UDF
>    Affects Versions: 0.8.0, 0.8.1, 0.9.0
>            Reporter: Ryan Harris
>              Labels: newbie, newdev, patch
>         Attachments: HIVE-3454.1.patch.txt
> Ran into an issue while working with timestamp conversion.
> CAST(unix_timestamp() as TIMESTAMP) should create a timestamp for the current time from
the BIGINT returned by unix_timestamp()
> Instead, however, a 1970-01-16 timestamp is returned.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message