Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-41433: [C++][Gandiva] Fix ascii_utf8 function to return same resul… #71

Merged
merged 1 commit into from
May 3, 2024

Conversation

DenisTarasyuk
Copy link

…t on x86 and Arm (apache#41434)

Rationale for this change

Fixing ascii_utf8 function that has different return result on x86 and Arm due to default char type sign difference on those platforms. Added tests to cover existing x86 behavior for ascii symbols with code >127.

What changes are included in this PR?

  1. Added type cast to signed char to save existing x86 behavior on Arm platform.
  2. Added tests cases for negative results.

Are these changes tested?

UT included.

Are there any user-facing changes?

None

Authored-by: DenisTarasyuk [email protected]

Copy link

❌ GitHub issue apache#41433 could not be retrieved.

… result on x86 and Arm (apache#41434)

### Rationale for this change
Fixing ascii_utf8 function that has different return result on x86 and Arm due to default char type sign difference on those platforms. Added tests to cover existing x86 behavior for ascii symbols with code >127.

### What changes are included in this PR?

1. Added type cast to signed char to save existing x86 behavior on Arm platform.
2. Added tests cases for negative results.

### Are these changes tested?
UT included.

### Are there any user-facing changes?
None

* GitHub Issue: apache#41433

Authored-by: DenisTarasyuk <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
@@ -1377,7 +1377,7 @@ gdv_int32 ascii_utf8(const char* data, gdv_int32 data_len) {
if (data_len == 0) {
return 0;
}
return static_cast<gdv_int32>(data[0]);
return static_cast<gdv_int32>(static_cast<signed char>(data[0]));

Choose a reason for hiding this comment

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

should we try changing the method signature to be const signed char * insead?

Copy link
Author

Choose a reason for hiding this comment

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

It won't build then as "some text" is const char and compiler has some strict validations for that. I have already tried.

@DenisTarasyuk DenisTarasyuk merged commit ae1df93 into dremio:dremio_25.0_15.0.1 May 3, 2024
42 of 82 checks passed
@DenisTarasyuk DenisTarasyuk deleted the DX-88701 branch May 3, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants