You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/22 09:15:56 UTC

[GitHub] [arrow] jpedroantunes commented on a change in pull request #10739: ARROW-13372: [C++][Gandiva] Implement FIND_IN_SET Hive function on Gandiva

jpedroantunes commented on a change in pull request #10739:
URL: https://github.com/apache/arrow/pull/10739#discussion_r674630494



##########
File path: cpp/src/gandiva/precompiled/string_ops_test.cc
##########
@@ -1555,6 +1555,29 @@ TEST(TestStringOps, TestBinaryString) {
   EXPECT_EQ(output, "OM");
 }
 
+TEST(TestStringOps, TestFindInSet) {
+  gandiva::ExecutionContext ctx;
+  uint64_t ctx_ptr = reinterpret_cast<gdv_int64>(&ctx);
+
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "HI", 2, "HI,B,C", 6), 1);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "HI", 2, ",B,C,HI", 7), 4);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "HI", 2, ",B,HI,HI,", 9), 3);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "", 0, ",B,A,A,", 7), 1);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "HI", 1, "HI,B,C", 6), 0);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "", 0, "B,C,A,", 6), 4);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "", 0, "B,C,,A,", 6), 3);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "A", 1, "B,A,", 4), 2);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "ha", 2, "hao,mn,hc,ha,hef", 16), 4);
+  EXPECT_EQ(find_in_set_utf8_utf8(ctx_ptr, "hef", 3, "hao,mn,hc,ha,hef", 16), 5);

Review comment:
       Good point! Solved




-- 
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