Skip to content

ORC-1475: [C++] ConvertColumnReader.TestConvertNumericToStringVariant fails when compiled with unsigned char - #1582

Merged
guiyanakuang merged 1 commit into
apache:branch-1.9from
wgtmac:unsigned_char
Aug 14, 2023
Merged

guiyanakuang merged 1 commit into
apache:branch-1.9from
wgtmac:unsigned_char

Conversation

@wgtmac

@wgtmac wgtmac commented Aug 14, 2023

Copy link
Copy Markdown
Member

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.

)

### 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.
@github-actions github-actions Bot added the CPP label Aug 14, 2023
@wgtmac

wgtmac commented Aug 14, 2023

Copy link
Copy Markdown
Member Author

Thanks @guiyanakuang for your review. This commit ports it into branch-1.9.

@guiyanakuang guiyanakuang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@guiyanakuang
guiyanakuang merged commit 23ebea6 into apache:branch-1.9 Aug 14, 2023
@guiyanakuang

Copy link
Copy Markdown
Member

Merged to branch-1.9, Thanks @wgtmac for making this pr.

@dongjoon-hyun

Copy link
Copy Markdown
Member

Hi, @wgtmac and @guiyanakuang . May I ask how to reproduce this bug in Docker testing?

@dongjoon-hyun dongjoon-hyun added this to the 1.9.2 milestone Aug 15, 2023
@dongjoon-hyun

Copy link
Copy Markdown
Member

I created Milestone 1.9.2 and added this there for now.

@wgtmac

wgtmac commented Aug 16, 2023 •

Copy link
Copy Markdown
Member Author

Hi, @wgtmac and @guiyanakuang . May I ask how to reproduce this bug in Docker testing?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33aaabd42..ff0143d9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,9 +108,9 @@ endif()
 # We require a C++17 compliant compiler
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 if (NOT MSVC)
-  set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fno-omit-frame-pointer")
-  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG -fno-omit-frame-pointer")
-  set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+  set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fno-omit-frame-pointer -funsigned-char")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG -fno-omit-frame-pointer -funsigned-char")
+  set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -funsigned-char")
 endif ()
 message(STATUS "compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}")
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
(END)

@dongjoon-hyun Simply add a -funsigned-char flag to compiler.

@dongjoon-hyun

Copy link
Copy Markdown
Member

@wgtmac My question was how to reproduce this bug in Docker testing because it was reported here via ./run-all.sh local branch-1.9 without any change. Apache ORC branch-1.9 doesn't have that flag, unsigned-char, in our source code or Dockerfiles.

bash-5.1$ ./run-all.sh local branch-1.9
Launching centos7 as 85438
...
FAILED centos7
...

@dongjoon-hyun

Copy link
Copy Markdown
Member

Let me ask on the original PR.

@wgtmac

wgtmac commented Aug 16, 2023 •

Copy link
Copy Markdown
Member Author

What is your host cpu running the docker test? @mystic-lama

gcc/clang uses signed-char by default on most platforms. But on ARM the default is unsigned-char.

@dongjoon-hyun

Copy link
Copy Markdown
Member

Oh, I posted #1579 (comment) without knowing your comment here. So, is it C++ compiler setting difference on Docker Intel and Docker ARM?

@dongjoon-hyun

Copy link
Copy Markdown
Member

You are right. I reproduced it on M1 Max. Previously, I ran Docker tests on old Intel Mac. So I missed that. Thank you, @wgtmac .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants