This is an automated email from the ASF dual-hosted git repository.
yqzhang 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 1c83941a2 ORC-1475: [C++] Fix the failure of UT when char is unsigned
(#1579)
1c83941a2 is described below
commit 1c83941a213a55c1d465bae1c02e49e260f7b9cd
Author: ffacs <[email protected]>
AuthorDate: Sun Aug 13 23:50:56 2023 +0800
ORC-1475: [C++] Fix the failure of UT when char is unsigned (#1579)
### What changes were proposed in this pull request?
Fix the failure of ConvertColumnReader.TestConvertNumericToStringVariant
when char is unsigned.
### Why are the changes needed?
The UT fails when compiled with unsigned char.
### How was this patch tested?
The UT is passed when compiled both with and without the flag
-funsigned-char.
---
c++/test/TestConvertColumnReader.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/c++/test/TestConvertColumnReader.cc
b/c++/test/TestConvertColumnReader.cc
index 77b000dfb..d0d690cf1 100644
--- a/c++/test/TestConvertColumnReader.cc
+++ b/c++/test/TestConvertColumnReader.cc
@@ -246,8 +246,8 @@ namespace orc {
for (int j = 0; j < TEST_CASES; j++) {
int flag = j % 2 == 0 ? -1 : 1;
uint64_t idx = static_cast<uint64_t>(j);
- col0.data[idx] = static_cast<char>(flag * (j % 128));
- col1.data[idx] = static_cast<short>(flag * (j % 32768));
+ col0.data[idx] = static_cast<int8_t>(flag * (j % 128));
+ col1.data[idx] = static_cast<int16_t>(flag * (j % 32768));
col2.data[idx] = flag * j;
col3.data[idx] = flag * j;
col4.data[idx] = static_cast<float>(flag * j) * 1.234f;
@@ -297,8 +297,8 @@ namespace orc {
for (size_t k = 0; k < 5; k++) {
int flag = j % 2 == 0 ? -1 : 1;
uint64_t idx = static_cast<uint64_t>(j);
- origin[6 * k + 0][idx] = std::to_string(static_cast<char>(flag * (j %
128)));
- origin[6 * k + 1][idx] = std::to_string(static_cast<short>(flag * (j %
32768)));
+ origin[6 * k + 0][idx] = std::to_string(static_cast<int8_t>(flag * (j
% 128)));
+ origin[6 * k + 1][idx] = std::to_string(static_cast<int16_t>(flag * (j
% 32768)));
origin[6 * k + 2][idx] = std::to_string(flag * j);
origin[6 * k + 3][idx] = std::to_string(flag * j);
origin[6 * k + 4][idx] = std::to_string(static_cast<float>(flag * j) *
1.234f);