You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lriggs (via GitHub)" <gi...@apache.org> on 2026/01/27 17:54:16 UTC
[PR] GH-49034 [C++][Gandiva] Fix binary_string to not trigger error for nu… [arrow]
lriggs opened a new pull request, #49035:
URL: https://github.com/apache/arrow/pull/49035
…ll strings.
### Rationale for this change
Fixes GH-49034.
The binary_string funcion will attempt to allocate 0 bytes of memory, which results in a null ptr being returned and the function interprets that as an error.
### What changes are included in this PR?
Add kCanReturnErrors to the function definition to match other string functions.
Move the check for 0 byte length input earlier in the binary_string function to prevent the 0 allocation.
Add a unit test.
### Are these changes tested?
Yes, unit and integration testing.
### Are there any user-facing changes?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-49034 [C++][Gandiva] Fix binary_string to not trigger error for nu… [arrow]
Posted by "lriggs (via GitHub)" <gi...@apache.org>.
lriggs commented on code in PR #49035:
URL: https://github.com/apache/arrow/pull/49035#discussion_r2733485360
##########
cpp/src/gandiva/precompiled/string_ops.cc:
##########
@@ -2252,6 +2252,11 @@ const char* right_utf8_int32(gdv_int64 context, const char* text, gdv_int32 text
FORCE_INLINE
const char* binary_string(gdv_int64 context, const char* text, gdv_int32 text_len,
gdv_int32* out_len) {
+ if (text_len == 0) {
+ *out_len = 0;
+ return "";
Review Comment:
It returns null, the same as Java.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-49034 [C++][Gandiva] Fix binary_string to not trigger error for nu… [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49035:
URL: https://github.com/apache/arrow/pull/49035#issuecomment-3806637406
:warning: GitHub issue #49034 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-49034 [C++][Gandiva] Fix binary_string to not trigger error for nu… [arrow]
Posted by "dmitry-chirkov-dremio (via GitHub)" <gi...@apache.org>.
dmitry-chirkov-dremio commented on code in PR #49035:
URL: https://github.com/apache/arrow/pull/49035#discussion_r2733219078
##########
cpp/src/gandiva/precompiled/string_ops.cc:
##########
@@ -2252,6 +2252,11 @@ const char* right_utf8_int32(gdv_int64 context, const char* text, gdv_int32 text
FORCE_INLINE
const char* binary_string(gdv_int64 context, const char* text, gdv_int32 text_len,
gdv_int32* out_len) {
+ if (text_len == 0) {
+ *out_len = 0;
+ return "";
Review Comment:
Java version is [NullHandling.NULL_IF_NULL](https://github.com/dremio/dremio/blob/b4e8471ef73776ead16b6e56fc783f472d828434/oss/sabot/kernel/src/main/java/com/dremio/exec/expr/fn/impl/StringFunctions.java#L2081C15-L2081C40)
Are we going to return empty string for null? If so - that's inconsistency we can't have.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-49034 [C++][Gandiva] Fix binary_string to not trigger error for null strings [arrow]
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou merged PR #49035:
URL: https://github.com/apache/arrow/pull/49035
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org