pitrou commented on code in PR #39264:
URL: https://github.com/apache/arrow/pull/39264#discussion_r1434318576


##########
cpp/src/arrow/compute/kernels/CMakeLists.txt:
##########
@@ -72,6 +72,12 @@ add_arrow_compute_test(scalar_utility_test
                        EXTRA_LINK_LIBS
                        arrow_compute_kernels_testing)
 
+add_arrow_compute_test(scalar_string_test
+                       SOURCES
+                       scalar_string_test.cc

Review Comment:
   This file is already compiled into `scalar_type_test`  above, so you don't 
need to add a new test declaration for it.



##########
cpp/src/arrow/compute/kernels/scalar_string_test.cc:
##########
@@ -1743,12 +1743,20 @@ TYPED_TEST(TestStringKernels, Utf8ReplaceSlice) {
 
 TYPED_TEST(TestBaseBinaryKernels, ReplaceSubstring) {
   ReplaceSubstringOptions options{"foo", "bazz"};
-  this->CheckUnary("replace_substring", R"(["foo", "this foo that foo", 
null])",
-                   this->type(), R"(["bazz", "this bazz that bazz", null])", 
&options);
+  this->CheckUnary("replace_substring", R"(["foo", "this foo that foo", "", 
null])",
+                   this->type(), R"(["bazz", "this bazz that bazz", "", 
null])", &options);
 
   options = ReplaceSubstringOptions{"foo", "bazz", 1};
-  this->CheckUnary("replace_substring", R"(["foo", "this foo that foo", 
null])",
-                   this->type(), R"(["bazz", "this bazz that foo", null])", 
&options);
+  this->CheckUnary("replace_substring", R"(["foo", "this foo that foo", "", 
null])",
+                   this->type(), R"(["bazz", "this bazz that foo", "", 
null])", &options);
+
+  options = ReplaceSubstringOptions{"", "bazz"};
+  this->CheckUnary("replace_substring", R"(["foo", "this foo that foo", "", 
null])",
+                   this->type(), R"(["foo", "this foo that foo", "", null])", 
&options);

Review Comment:
   Is this the desired semantics? Python does this:
   ```python
   >>> s = "abcde"
   >>> s.replace("", "zz")
   'zzazzbzzczzdzzezz'
   ```



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