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/05/06 16:56:40 UTC

[GitHub] [arrow] thisisnic commented on a change in pull request #10190: ARROW-11515: [R] Bindings for strsplit

thisisnic commented on a change in pull request #10190:
URL: https://github.com/apache/arrow/pull/10190#discussion_r627606845



##########
File path: r/tests/testthat/test-dplyr-string-functions.R
##########
@@ -239,6 +239,53 @@ test_that("str_replace and str_replace_all", {
 
 })
 
+test_that("strsplit and str_split", {
+  df <- tibble(x = c("Foo and bar", "baz and qux and quux"))
+  
+  expect_dplyr_equal(
+    input %>%
+      transmute(x = strsplit(x, "and")) %>%
+      collect(),
+    df
+  )
+
+  expect_warning(
+    df %>%
+    Table$create() %>%
+      mutate(x = strsplit(x, "and.*", fixed = FALSE)) %>%
+      collect(),
+    regexp = "not supported in Arrow"
+  )
+
+  expect_dplyr_equal(
+    input %>%
+      mutate(x = strsplit(x, "and.*", fixed = TRUE)) %>%
+      collect(),
+    df
+  )
+
+  expect_dplyr_equal(
+    input %>%
+      transmute(x = str_split(x, "and")) %>%
+      collect(),
+    df
+  )
+
+  expect_dplyr_equal(
+    input %>%
+      transmute(x = str_split(x, "and", n = 2)) %>%
+      collect(),
+    df
+  )
+
+  expect_warning(
+    df %>%
+      Table$create() %>%
+      mutate(x = str_split(x, "and.?")) %>%
+      collect()
+  )
+})
+

Review comment:
       Done now!




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