[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 <yodal@oss.nttdata.com>
Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
This commit is contained in:
Leona Yoda 2021-09-30 14:43:09 +09:00 committed by Kousuke Saruta
parent ad5a53511e
commit 17e3ca6df5
4 changed files with 7 additions and 1 deletions

View file

@ -316,6 +316,7 @@ exportMethods("%<=>%",
"hour",
"hypot",
"ifelse",
"ilike",
"initcap",
"input_file_name",
"instr",

View file

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

View file

@ -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") })

View file

@ -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) ==