[ 
https://issues.apache.org/jira/browse/ORC-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16444485#comment-16444485
 ] 

rip.nsk edited comment on ORC-346 at 4/19/18 6:00 PM:
------------------------------------------------------

TEST(Writer, writeTimestamp) failed with the following change:

diff --git a/c++/test/TestWriter.cc b/c++/test/TestWriter.cc
@@ -573,7 +573,7 @@ namespace orc {

- time_t currTime = std::time(nullptr);
 + time_t currTime = -14210715; // 1969-07-20 12:34:45


was (Author: rip....@gmail.com):
TEST(Writer, writeTimestamp) failed with the following change:

diff --git a/c++/test/TestWriter.cc b/c++/test/TestWriter.cc
index c61d184..40d9243 100644
--- a/c++/test/TestWriter.cc
+++ b/c++/test/TestWriter.cc
@@ -570,7 +570,7 @@ namespace orc {
 
 std::vector<std::time_t> times(rowCount);
 for (uint64_t i = 0; i < rowCount; ++i) {
- time_t currTime = std::time(nullptr);
+ time_t currTime = -14210715; // 1969-07-20 12:34:45
 times[i] = static_cast<int64_t>(currTime) - static_cast<int64_t >(i * 60);
 tsBatch->data[i] = times[i];
 tsBatch->nanoseconds[i] = static_cast<int64_t>(i * 1000);

> Bug in TimestampColumnReader
> ----------------------------
>
>                 Key: ORC-346
>                 URL: https://issues.apache.org/jira/browse/ORC-346
>             Project: ORC
>          Issue Type: Bug
>          Components: C++
>            Reporter: rip.nsk
>            Priority: Critical
>
> void TimestampColumnReader::next(ColumnVectorBatch& rowBatch, uint64_t 
> numValues, char *notNull)
> has the following code:
> c++\src\ColumnReader.cc:338
> int64_t writerTime = secsBuffer[i] + epochOffset;
>  secsBuffer[i] = writerTimezone.convertToUTC(writerTime);
>  {color:#f79232}if (secsBuffer[i] < 0 && nanoBuffer[i] != 0) {{color}
> {color:#f79232} secsBuffer[i] -= 1;{color}
> {color:#f79232} }{color}
> {color:#333333}which likely leads to read wrong seconds value for PRE_1970 
> dates{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to