This is an automated email from the ASF dual-hosted git repository. sarutak pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 17e3ca6 [SPARK-36899][R] Support ILIKE API on R 17e3ca6 is described below commit 17e3ca6df5eb4b7b74cd8d04868da39eb0137826 Author: Leona Yoda <yo...@oss.nttdata.com> AuthorDate: Thu Sep 30 14:43:09 2021 +0900 [SPARK-36899][R] Support ILIKE API on R ### What changes were proposed in this pull request? Support ILIKE (case insensitive LIKE) API on R. ### Why are the changes needed? ILIKE statement on SQL interface is supported by SPARK-36674. This PR will support R API for it. ### Does this PR introduce _any_ user-facing change? Yes. Users can call ilike from R. ### How was this patch tested? Unit tests. Closes #34152 from yoda-mon/r-ilike. Authored-by: Leona Yoda <yo...@oss.nttdata.com> Signed-off-by: Kousuke Saruta <saru...@oss.nttdata.com> --- R/pkg/NAMESPACE | 1 + R/pkg/R/column.R | 2 +- R/pkg/R/generics.R | 3 +++ R/pkg/tests/fulltests/test_sparkSQL.R | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/R/pkg/NAMESPACE b/R/pkg/NAMESPACE index 5de7aeb..11403f6 100644 --- a/R/pkg/NAMESPACE +++ b/R/pkg/NAMESPACE @@ -316,6 +316,7 @@ exportMethods("%<=>%", "hour", "hypot", "ifelse", + "ilike", "initcap", "input_file_name", "instr", diff --git a/R/pkg/R/column.R b/R/pkg/R/column.R index 9fa117c..f1fd30e 100644 --- a/R/pkg/R/column.R +++ b/R/pkg/R/column.R @@ -72,7 +72,7 @@ column_functions1 <- c( "desc", "desc_nulls_first", "desc_nulls_last", "isNaN", "isNull", "isNotNull" ) -column_functions2 <- c("like", "rlike", "getField", "getItem", "contains") +column_functions2 <- c("like", "rlike", "ilike", "getField", "getItem", "contains") createOperator <- function(op) { setMethod(op, diff --git a/R/pkg/R/generics.R b/R/pkg/R/generics.R index 9da818b..ad29a70 100644 --- a/R/pkg/R/generics.R +++ b/R/pkg/R/generics.R @@ -725,6 +725,9 @@ setGeneric("like", function(x, ...) { standardGeneric("like") }) #' @rdname columnfunctions setGeneric("rlike", function(x, ...) { standardGeneric("rlike") }) +#' @rdname columnfunctions +setGeneric("ilike", function(x, ...) { standardGeneric("ilike") }) + #' @rdname startsWith setGeneric("startsWith", function(x, prefix) { standardGeneric("startsWith") }) diff --git a/R/pkg/tests/fulltests/test_sparkSQL.R b/R/pkg/tests/fulltests/test_sparkSQL.R index bd5c250..1d8ac2b 100644 --- a/R/pkg/tests/fulltests/test_sparkSQL.R +++ b/R/pkg/tests/fulltests/test_sparkSQL.R @@ -2130,6 +2130,8 @@ test_that("higher order functions", { expr("transform(xs, (x, i) -> CASE WHEN ((i % 2.0) = 0.0) THEN x ELSE (- x) END)"), array_exists("vs", function(v) rlike(v, "FAILED")) == expr("exists(vs, v -> (v RLIKE 'FAILED'))"), + array_exists("vs", function(v) ilike(v, "failed")) == + expr("exists(vs, v -> (v ILIKE 'failed'))"), array_forall("xs", function(x) x > 0) == expr("forall(xs, x -> x > 0)"), array_filter("xs", function(x, i) x > 0 | i %% 2 == 0) == --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org