projjal commented on code in PR #12391:
URL: https://github.com/apache/arrow/pull/12391#discussion_r927535154


##########
cpp/src/gandiva/precompiled/string_ops_test.cc:
##########
@@ -2702,4 +2702,26 @@ TEST(TestStringOps, TestInstr) {
   result = instr_utf8(s1.c_str(), s1_len, s2.c_str(), s2_len);
   EXPECT_EQ(result, 8);
 }
+
+TEST(TestStringOps, TestFindInSet) {
+  gandiva::ExecutionContext ctx;
+  auto ctx_ptr = reinterpret_cast<int64_t>(&ctx);
+  int32_t result;
+  result = find_in_set_utf8_utf8(ctx_ptr, "EE", 2, ",A,B,C,D,EE,F", 13);
+  EXPECT_EQ(result, 6);
+  result = find_in_set_utf8_utf8(ctx_ptr, "A", 1, "A,B,C,D,EE,F", 12);
+  EXPECT_EQ(result, 1);
+  result = find_in_set_utf8_utf8(ctx_ptr, "AAAB", 4, "A,B,C,D,EE,F", 12);
+  EXPECT_EQ(result, 0);
+  result = find_in_set_utf8_utf8(ctx_ptr, "E,E", 3, "A,B,C,D,EE,F", 12);
+  EXPECT_EQ(result, 0);
+  result = find_in_set_utf8_utf8(ctx_ptr, "C", 1, "A,B,,,,,,,C,,,,,", 16);

Review Comment:
   Can you add following testcases
   find_in_set("", "a,b,,c,d") = 3
   find_in_set("", ",") = 1
   Also add a test case with multibyte charaters just in case.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to