-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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-13780: [Gandiva][UDF] Fix bug in udf space/rpad/lpad #11016
Changes from 2 commits
2dd425b
3321c69
031f2fe
e3f41ee
ed83b4a
0352975
ffda9cd
f8176a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,10 @@ TEST(TestStringOps, TestSpace) { | |
EXPECT_EQ(std::string(out, out_len), " "); | ||
out = space_int32(ctx_ptr, -5, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), ""); | ||
out = space_int32(ctx_ptr, 65537, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), std::string(65536, ' ')); | ||
out = space_int32(ctx_ptr, 2147483647, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), std::string(65536, ' ')); | ||
|
||
out = space_int64(ctx_ptr, 2, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), " "); | ||
|
@@ -92,6 +96,12 @@ TEST(TestStringOps, TestSpace) { | |
EXPECT_EQ(std::string(out, out_len), " "); | ||
out = space_int64(ctx_ptr, -5, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), ""); | ||
out = space_int64(ctx_ptr, 65536, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), std::string(65536, ' ')); | ||
out = space_int64(ctx_ptr, 9223372036854775807, &out_len); | ||
EXPECT_EQ(std::string(out, out_len), std::string(65536, ' ')); | ||
out = space_int64(ctx_ptr, -2639077559, &out_len); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the error is appearing in the AppVeyor build is because you are using a value that is lower than the minimum integer. Try to change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems still not working. But thank you anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ZMZ91 I think Projjal's suggestion worked! I looked at the failed tests and it seems that was caused by environment issues when it tries to install dependencies. Do the rebase with Arrow's master repository and push it to execute the builds again! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you @anthonylouisbsb! BTW, could you help check my another pr #10884? That one was opened even much earlier than this one. |
||
EXPECT_EQ(std::string(out, out_len), ""); | ||
} | ||
|
||
TEST(TestStringOps, TestIsSubstr) { | ||
|
@@ -1034,6 +1044,9 @@ TEST(TestStringOps, TestLpadString) { | |
out_str = lpad_utf8_int32_utf8(ctx_ptr, "hello", 5, 6, "д", 2, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "дhello"); | ||
|
||
out_str = lpad_utf8_int32_utf8(ctx_ptr, "大学路", 9, 65536, "哈", 3, &out_len); | ||
EXPECT_EQ(out_len, 65536 * 3); | ||
|
||
// LPAD function tests - with NO pad text | ||
out_str = lpad_utf8_int32(ctx_ptr, "TestString", 10, 4, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "Test"); | ||
|
@@ -1058,6 +1071,12 @@ TEST(TestStringOps, TestLpadString) { | |
|
||
out_str = lpad_utf8_int32(ctx_ptr, "абвгд", 10, 7, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), " абвгд"); | ||
|
||
out_str = lpad_utf8_int32(ctx_ptr, "TestString", 10, 65537, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), std::string(65526, ' ') + "TestString"); | ||
|
||
out_str = lpad_utf8_int32(ctx_ptr, "TestString", 10, -1, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), ""); | ||
} | ||
|
||
TEST(TestStringOps, TestRpadString) { | ||
|
@@ -1103,6 +1122,9 @@ TEST(TestStringOps, TestRpadString) { | |
out_str = rpad_utf8_int32_utf8(ctx_ptr, "hello", 5, 6, "д", 2, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "helloд"); | ||
|
||
out_str = rpad_utf8_int32_utf8(ctx_ptr, "大学路", 9, 655360, "哈雷路", 3, &out_len); | ||
EXPECT_EQ(out_len, 65536 * 3); | ||
|
||
// RPAD function tests - with NO pad text | ||
out_str = rpad_utf8_int32(ctx_ptr, "TestString", 10, 4, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "Test"); | ||
|
@@ -1127,6 +1149,12 @@ TEST(TestStringOps, TestRpadString) { | |
|
||
out_str = rpad_utf8_int32(ctx_ptr, "абвгд", 10, 7, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "абвгд "); | ||
|
||
out_str = rpad_utf8_int32(ctx_ptr, "TestString", 10, 65537, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), "TestString" + std::string(65526, ' ')); | ||
|
||
out_str = rpad_utf8_int32(ctx_ptr, "TestString", 10, -1, &out_len); | ||
EXPECT_EQ(std::string(out_str, out_len), ""); | ||
} | ||
|
||
TEST(TestStringOps, TestRtrim) { | ||
|
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.
return_char_length seems to be used only for allocation. Shouldn't the while loop in 1832 also use return_char_length?
Never mind, the text_char_count was confusing. I think the text_char_count is actually text_len - invalid utf8..maybe rename 'text_char_count' to 'actual_text_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.
Changed to actual_text_len. @rkavanap if no more issues, could you help merge this pr since it's been quite a while since open. Thanks a lot.
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.
@ZMZ91 I am done with my review and this PR looks good. Please let me know what else I need to do to help merge the PR.
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.
What should I do next? I have no permission to merge this pr, right?
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.
Can you check with @projjal ?
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.
ALso you may have to rebase and make the failing checks pass