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


   This adds a split_pattern_regex kernel using RE2.
   
   Caveats:
   - RE2 requires us to wrap the user's regex in a capture group in order to 
actually get the matched delimiter.
   - Reverse splitting is not implemented - there's not a good way to do this 
with RE2.
   - In R, strsplit behaves differently - trailing empty splits are no longer 
dropped:
   
   ```
   > df <- tibble(x = c("foo bar"))
   > (df %>% mutate(x = strsplit(x, "bar")) %>% collect())$x
   [[1]]
   [1] "foo "
   
   > (record_batch(df) %>% mutate(x = strsplit(x, "bar")) %>% collect())$x
   <list<character>[1]>
   [[1]]
   [1] "foo " ""   
   ```
   
   So the behavior here does not exactly match R. Though this was already the 
case:
   
   ```
   > (df %>% mutate(x = strsplit(x, "bar", fixed = TRUE)) %>% collect())$x
   [[1]]
   [1] "foo "
   
   > (record_batch(df) %>% mutate(x = strsplit(x, "bar", fixed = TRUE)) %>% 
collect())$x
   <list<character>[1]>
   [[1]]
   [1] "foo " ""    
   ```


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


Reply via email to