orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wenlei Xie <wenlei....@gmail.com>
Subject TIMESTAMP Encoding for 1969-12-31 23:59:59.5 in ORC
Date Fri, 18 May 2018 04:05:21 GMT
Hi,

>From the code encoding TIMESTAMP:

          final long secs = vec.time[i + offset] / MILLIS_PER_SECOND;
>           final int newNanos = vec.nanos[i + offset];




So for 1969-12-31 23:59:59.500, it will be:

    secs = 0                                (-500 / 1000)
    newNanos = 500_000_000   (500ms)

Thus when the time is reading back, it will be 1970-01-01 00:00:00.500
right?

For timestamp earlier than 1969-12-31 23:59:59, since secs will be
negative, decoder will subtracted the result by 1 second. However, for
timestamp within 1969-12-31 23:59:59 and 1970-01-01 00:00:00, it looks like
the data will be read back as a timestamp 1 second later?


Thank you !


(The encoding is https://github.com/apache/orc/blob/
5b5c0d5bb14469ddf8e399b4ed879cc1cca9bec6/java/core/src/java/
org/apache/orc/impl/writer/TimestampTreeWriter.java#L127-L128 )


Best,
Wenlei

-- 
Best Regards,

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message