SMason1441 opened a new pull request, #39264:
URL: https://github.com/apache/arrow/pull/39264

   
   
   ### Rationale for this change
   
   There was a bug in replace_substring that caused it to hang if the pattern 
was empty.
   
   ### What changes are included in this PR?
   
   Followed the guidance given in the comment by Alenka in 
https://github.com/apache/arrow/issues/39149. However after some 
experimentation I noticed that the issue was that the function ReplaceString 
would hang forever if the pattern was empty. This is because the update rule in 
the while loop is i += size of pattern (which is 0). Now, when the pattern is 
empty, the resulting string will remain the same. 
   
   I am also adding the file scalar_string_tests.cc to the CMakeLists.txt in 
the cpp/arrow/src/compute/kernels directory since I noticed the tests were 
missing.
   
   ### Are these changes tested?
   
   I added extended the existing tests to include cases where the string was 
empty and where the pattern was empty. 
   
   ### Are there any user-facing changes?
   
   Closes #39149


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