Github user zero323 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17729#discussion_r112853834
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -1546,6 +1546,40 @@ test_that("string operators", {
       expect_equal(collect(select(df3, substring_index(df3$a, ".", 2)))[1, 1], 
"a.b")
       expect_equal(collect(select(df3, substring_index(df3$a, ".", -3)))[1, 
1], "b.c.d")
       expect_equal(collect(select(df3, translate(df3$a, "bc", "12")))[1, 1], 
"a.1.2.d")
    +
    +  l4 <- list(list(a = "[email protected]   1\\b"))
    +  df4 <- createDataFrame(l4)
    +  expect_equal(
    +    collect(select(df4, split_string(df4$a, "\\s+")))[1, 1],
    +    list(list("[email protected]", "1\\b"))
    +  )
    +  expect_equal(
    +    collect(select(df4, split_string(df4$a, "\\.")))[1, 1],
    +    list(list("a", "b@c", "d   1\\b"))
    +  )
    +  expect_equal(
    +    collect(select(df4, split_string(df4$a, "@")))[1, 1],
    +    list(list("a.b", "c.d   1\\b"))
    +  )
    +  expect_equal(
    +    collect(select(df4, split_string(df4$a, "\\\\")))[1, 1],
    +    list(list("[email protected]   1", "b"))
    +  )
    +
    +  l5 <- list(list(a = "abc"))
    +  df5 <- createDataFrame(l5)
    +  expect_equal(
    +    collect(select(df5, repeat_string(df5$a, 1L)))[1, 1],
    +    "abc"
    +  )
    +  expect_equal(
    +    collect(select(df5, repeat_string(df5$a, 3)))[1, 1],
    +    "abcabcabc"
    +  )
    +  expect_equal(
    +    collect(select(df5, repeat_string(df5$a, -1)))[1, 1],
    --- End diff --
    
    Right? I think we should keep it this way to avoid any confusion when users 
switch between SQL and DSL. If anything changes it will cause test failure and 
then we can add R side checks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to