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/06/04 15:47:34 UTC

[GitHub] [arrow] lidavidm opened a new pull request #10454: ARROW-12950: [C++] Add count_substring kernel

lidavidm opened a new pull request #10454:
URL: https://github.com/apache/arrow/pull/10454


   Depends on ARROW-12969. ignore_case is not included here; I'll include it with the regex variant in ARROW-12952.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou commented on a change in pull request #10454: ARROW-12950: [C++] Add count_substring kernel

Posted by GitBox <gi...@apache.org>.
pitrou commented on a change in pull request #10454:
URL: https://github.com/apache/arrow/pull/10454#discussion_r646747304



##########
File path: cpp/src/arrow/compute/kernels/scalar_string_test.cc
##########
@@ -91,6 +91,25 @@ TYPED_TEST(TestBinaryKernels, FindSubstring) {
   MatchSubstringOptions options_double_char_2{"bbcaa"};
   this->CheckUnary("find_substring", R"(["abcbaabbbcaabccabaab"])", this->offset_type(),
                    "[7]", &options_double_char_2);
+
+  MatchSubstringOptions options_empty{""};
+  this->CheckUnary("find_substring", R"(["", "a", null])", this->offset_type(),
+                   "[0, 0, null]", &options_empty);
+}
+
+TYPED_TEST(TestBinaryKernels, CountSubstring) {
+  MatchSubstringOptions options{"aba"};
+  this->CheckUnary("count_substring", "[]", this->offset_type(), "[]", &options);
+  this->CheckUnary(
+      "count_substring",
+      R"(["", null, "ab", "aba", "baba", "ababa", "abaaba", "babacaba", "ABA"])",
+      this->offset_type(), "[0, null, 0, 1, 1, 1, 2, 2, 0]", &options);
+
+  MatchSubstringOptions options_empty{""};
+  this->CheckUnary("count_substring", R"(["", null, "abc"])", this->offset_type(),
+                   "[1, null, 4]", &options_empty);
+
+  // TODO: case-insensitive

Review comment:
       I'd like to see a more challenging use case, e.g. counting the number of occurrences of `"aa"` in `"aaaaa"`.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #10454: ARROW-12950: [C++] Add count_substring kernel

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #10454:
URL: https://github.com/apache/arrow/pull/10454#issuecomment-854829355


   https://issues.apache.org/jira/browse/ARROW-12950


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou commented on pull request #10454: ARROW-12950: [C++] Add count_substring kernel

Posted by GitBox <gi...@apache.org>.
pitrou commented on pull request #10454:
URL: https://github.com/apache/arrow/pull/10454#issuecomment-856077939


   Could you rebase now that the parent issue has been fixed?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou closed pull request #10454: ARROW-12950: [C++] Add count_substring kernel

Posted by GitBox <gi...@apache.org>.
pitrou closed pull request #10454:
URL: https://github.com/apache/arrow/pull/10454


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou commented on pull request #10454: ARROW-12950: [C++] Add count_substring kernel

Posted by GitBox <gi...@apache.org>.
pitrou commented on pull request #10454:
URL: https://github.com/apache/arrow/pull/10454#issuecomment-856174113


   Travis-CI: https://travis-ci.com/github/pitrou/arrow/builds/228231543


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org