-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ARROW-13826: [C++][Gandiva] Implement QUOTE Hive functions on Gandiva #11049
Conversation
|
5485f7b
to
3b4aadd
Compare
EXPECT_EQ(std::string(out_str, out_len), ""); | ||
EXPECT_FALSE(ctx.has_error()); | ||
|
||
out_str = quote_utf8(ctx_ptr, "'", 1, &out_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good test. Maybe another one like this "''''''''''''''''''''''" with more quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test with more quotes
return ""; | ||
} | ||
// try to allocate double size output string (worst case) | ||
auto out = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, in_len * 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be in_len * 2 + 2 for the worst case of the loop? or does in_len include the null termination of the string? Actually I see at least in the unit test that in_len does not include the null_termination of the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense, added the +2 for the worst case of the loop
} | ||
counter++; | ||
} | ||
out[counter] = '\''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this overflow for a quote only string. let us say we have a string with single quote of len 1,, then out is of len 2, but counter could be 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out len should be three as the out string will be 3 quotes, as the input single quote should be quoted
55702b9
to
d9d7531
Compare
336ab86
to
9f809b0
Compare
Benchmark runs are scheduled for baseline = ad61fe2 and contender = c0f68a4. c0f68a4 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Implement QUOTE Hive functions on Gandiva