You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by ga...@apache.org on 2022/11/28 01:27:50 UTC

[orc] branch main updated: ORC-1315: [C++] Fix test failure when unsigned char is in effect

This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 91ded7690 ORC-1315: [C++] Fix test failure when unsigned char is in effect
91ded7690 is described below

commit 91ded7690fd34df100961d70890bff987911007d
Author: Gang Wu <us...@gmail.com>
AuthorDate: Mon Nov 28 09:27:43 2022 +0800

    ORC-1315: [C++] Fix test failure when unsigned char is in effect
    
    This closes #1324
---
 c++/src/ColumnReader.cc      | 5 ++---
 c++/test/TestColumnReader.cc | 5 +++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/c++/src/ColumnReader.cc b/c++/src/ColumnReader.cc
index eb23cd4a2..fac262935 100644
--- a/c++/src/ColumnReader.cc
+++ b/c++/src/ColumnReader.cc
@@ -125,12 +125,11 @@ namespace orc {
    */
   template <typename T>
   void expandBytesToIntegers(T* buffer, uint64_t numValues) {
-    if (sizeof(T) == sizeof(char)) {
+    if (sizeof(T) == sizeof(int8_t)) {
       return;
     }
     for (uint64_t i = 0UL; i < numValues; ++i) {
-      buffer[numValues - 1 - i] =
-          static_cast<T>(reinterpret_cast<char*>(buffer)[numValues - 1 - i]);
+      buffer[numValues - 1 - i] = reinterpret_cast<int8_t*>(buffer)[numValues - 1 - i];
     }
   }
 
diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc
index e1c3bd235..7976238a2 100644
--- a/c++/test/TestColumnReader.cc
+++ b/c++/test/TestColumnReader.cc
@@ -259,7 +259,8 @@ namespace orc {
         EXPECT_EQ(0, longBatch->notNull[i]) << "Wrong value at " << i;
       } else {
         EXPECT_EQ(1, longBatch->notNull[i]) << "Wrong value at " << i;
-        EXPECT_EQ(static_cast<char>(next++), longBatch->data[i]) << "Wrong value at " << i;
+        EXPECT_EQ(static_cast<char>(next++), static_cast<char>(longBatch->data[i]))
+            << "Wrong value at " << i;
       }
     }
   }
@@ -318,7 +319,7 @@ namespace orc {
     ASSERT_EQ(true, !batch.hasNulls);
     ASSERT_EQ(5, longBatch->numElements);
     ASSERT_EQ(true, longBatch->hasNulls);
-    EXPECT_EQ(static_cast<char>(-1), longBatch->data[0]);
+    EXPECT_EQ(static_cast<char>(-1), static_cast<char>(longBatch->data[0]));
     EXPECT_EQ(true, !longBatch->notNull[1]);
     EXPECT_EQ(true, !longBatch->notNull[2]);
     EXPECT_EQ(true, !longBatch->notNull[3]);