Repository: orc
Updated Branches:
  refs/heads/master feebab80b -> f90dee2da


ORC-271. Improve HAS_PRE_1970 check and fix dependent tests.

Fixes #197

Signed-off-by: rip-nsk <[email protected]>
Signed-off-by: Owen O'Malley <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/f90dee2d
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/f90dee2d
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/f90dee2d

Branch: refs/heads/master
Commit: f90dee2da2ae5cf11165551f8bc6998846c47a89
Parents: feebab8
Author: rip.nsk <[email protected]>
Authored: Mon Dec 4 16:34:36 2017 -0800
Committer: Owen O'Malley <[email protected]>
Committed: Tue Jan 16 11:10:21 2018 -0800

----------------------------------------------------------------------
 c++/src/CMakeLists.txt        | 5 +++--
 c++/test/TestColumnPrinter.cc | 6 ++++++
 c++/test/TestColumnReader.cc  | 5 ++++-
 3 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/f90dee2d/c++/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 51811ca..c76f793 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -90,8 +90,9 @@ INCLUDE(CheckCXXSourceRuns)
 CHECK_CXX_SOURCE_RUNS("
     #include<time.h>
     int main(int, char *[]) {
-      time_t t = -1000;
-      return gmtime(&t) == 0;
+      time_t t = -14210715; // 1969-07-20 12:34:45
+      struct tm *ptm = gmtime(&t);
+      return !(ptm && ptm->tm_year == 69);
     }"
   HAS_PRE_1970
 )

http://git-wip-us.apache.org/repos/asf/orc/blob/f90dee2d/c++/test/TestColumnPrinter.cc
----------------------------------------------------------------------
diff --git a/c++/test/TestColumnPrinter.cc b/c++/test/TestColumnPrinter.cc
index 75930ef..f2ca6be 100644
--- a/c++/test/TestColumnPrinter.cc
+++ b/c++/test/TestColumnPrinter.cc
@@ -221,6 +221,9 @@ namespace orc {
                               "\"2003-08-11\""};
     printer->reset(batch);
     for(uint64_t i=0; i < batch.numElements; ++i) {
+#ifndef HAS_PRE_1970
+      if (batch.data[i] < 0) continue;
+#endif
       line.clear();
       printer->printRow(i);
       EXPECT_EQ(expected[i], line) << "for i = " << i;
@@ -231,6 +234,9 @@ namespace orc {
     }
     printer->reset(batch);
     for(uint64_t i=0; i < batch.numElements; ++i) {
+#ifndef HAS_PRE_1970
+      if (batch.data[i] < 0) continue;
+#endif
       line.clear();
       printer->printRow(i);
       if (i % 2) {

http://git-wip-us.apache.org/repos/asf/orc/blob/f90dee2d/c++/test/TestColumnReader.cc
----------------------------------------------------------------------
diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc
index 6278623..fe1740f 100644
--- a/c++/test/TestColumnReader.cc
+++ b/c++/test/TestColumnReader.cc
@@ -2841,12 +2841,15 @@ TEST(TestColumnReader, testTimestamp) {
 
   for (size_t i = 0; i < batch.numElements; ++i) {
     time_t time = static_cast<time_t>(longBatch->data[i]);
+    EXPECT_EQ(expectedNano[i], longBatch->nanoseconds[i]);
+#ifndef HAS_PRE_1970
+    if (time < 0) continue;
+#endif
     tm timeStruct;
     ASSERT_PRED1(isNotNull, gmtime_r(&time, &timeStruct));
     char buffer[30];
     asctime_r(&timeStruct, buffer);
     EXPECT_STREQ(expected[i], buffer) << "Wrong value at " << i;
-    EXPECT_EQ(expectedNano[i], longBatch->nanoseconds[i]);
   }
 }
 

Reply via email to