You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2018/04/27 22:15:48 UTC
orc git commit: ORC-346. Add one second when writing negative
Timestamp's with non zero nanos to match the reader code.
Repository: orc
Updated Branches:
refs/heads/master 896dffc3e -> 831b2eca7
ORC-346. Add one second when writing negative Timestamp's with non zero nanos to match the reader code.
Fixes #253
Signed-off-by: Owen O'Malley <om...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/831b2eca
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/831b2eca
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/831b2eca
Branch: refs/heads/master
Commit: 831b2eca724f53be334dfccfeb1ebca4949c5621
Parents: 896dffc
Author: rip-nsk <ri...@gmail.com>
Authored: Thu Apr 19 12:22:09 2018 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Fri Apr 27 15:12:16 2018 -0700
----------------------------------------------------------------------
c++/src/ColumnWriter.cc | 4 ++++
c++/test/TestWriter.cc | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/orc/blob/831b2eca/c++/src/ColumnWriter.cc
----------------------------------------------------------------------
diff --git a/c++/src/ColumnWriter.cc b/c++/src/ColumnWriter.cc
index 91e6713..8b82783 100644
--- a/c++/src/ColumnWriter.cc
+++ b/c++/src/ColumnWriter.cc
@@ -1199,6 +1199,10 @@ namespace orc {
tsStats->increase(1);
tsStats->update(millsUTC);
+ if (secs[i] < 0 && nanos[i] != 0) {
+ secs[i] += 1;
+ }
+
secs[i] -= timezone.getEpoch();
nanos[i] = formatNano(nanos[i]);
} else if (!hasNull) {
http://git-wip-us.apache.org/repos/asf/orc/blob/831b2eca/c++/test/TestWriter.cc
----------------------------------------------------------------------
diff --git a/c++/test/TestWriter.cc b/c++/test/TestWriter.cc
index 636ad6b..627c9c4 100644
--- a/c++/test/TestWriter.cc
+++ b/c++/test/TestWriter.cc
@@ -570,8 +570,8 @@ namespace orc {
std::vector<std::time_t> times(rowCount);
for (uint64_t i = 0; i < rowCount; ++i) {
- time_t currTime = std::time(nullptr);
- times[i] = static_cast<int64_t>(currTime) - static_cast<int64_t >(i * 60);
+ time_t currTime = -14210715; // 1969-07-20 12:34:45
+ times[i] = static_cast<int64_t>(currTime) + static_cast<int64_t >(i * 3660);
tsBatch->data[i] = times[i];
tsBatch->nanoseconds[i] = static_cast<int64_t>(i * 1000);
}