From ad6179e5ddb5f00169001106ef5d8a2024e92b87 Mon Sep 17 00:00:00 2001 From: Eric Kidd Date: Fri, 16 Feb 2024 11:06:39 -0500 Subject: [PATCH] Allow REPLACE --- src/scope.rs | 1 + tests/sql/functions/simple/replace.sql | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/sql/functions/simple/replace.sql diff --git a/src/scope.rs b/src/scope.rs index ed7b599..f63f15b 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -282,6 +282,7 @@ RAND = Fn() -> FLOAT64; RANK = FnOver() -> INT64; REGEXP_EXTRACT = Fn(STRING, STRING) -> STRING; REGEXP_REPLACE = Fn(STRING, STRING, STRING) -> STRING; +REPLACE = Fn(STRING, STRING, STRING) -> STRING; ROW_NUMBER = FnOver() -> INT64; SHA256 = Fn(STRING) -> BYTES; SUM = FnAgg(Agg) -> INT64 | FnAgg(Agg) -> FLOAT64 diff --git a/tests/sql/functions/simple/replace.sql b/tests/sql/functions/simple/replace.sql new file mode 100644 index 0000000..4524171 --- /dev/null +++ b/tests/sql/functions/simple/replace.sql @@ -0,0 +1,11 @@ +-- pending: sqlite3 Probably exists, but haven't checked. + +CREATE OR REPLACE TABLE __result1 AS +SELECT + replace('hello world', 'world', 'universe') AS replace1; + +CREATE OR REPLACE TABLE __expected1 ( + replace1 STRING +); +INSERT INTO __expected1 VALUES + ('hello universe');