From 824df2c19397591f265cffbf694414cc9fa9e80e Mon Sep 17 00:00:00 2001 From: Xianyang Liu Date: Wed, 20 Nov 2024 01:15:19 +0800 Subject: [PATCH] [BUG] Fixes regexp_replace expression (#3306) `regexp_replace` should set regex to True --- src/daft-sql/src/modules/utf8.rs | 2 +- tests/sql/test_utf8_exprs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daft-sql/src/modules/utf8.rs b/src/daft-sql/src/modules/utf8.rs index edf3b3133e..7e53081b99 100644 --- a/src/daft-sql/src/modules/utf8.rs +++ b/src/daft-sql/src/modules/utf8.rs @@ -233,7 +233,7 @@ utf8_function!( utf8_function!( SQLUtf8RegexpReplace, "regexp_replace", - |input, pattern, replacement| daft_functions::utf8::replace(input, pattern, replacement, false), + |input, pattern, replacement| daft_functions::utf8::replace(input, pattern, replacement, true), "Replaces all occurrences of a substring with a new string", "string_input", "pattern", diff --git a/tests/sql/test_utf8_exprs.py b/tests/sql/test_utf8_exprs.py index 61b2b88d3e..8f45032c4e 100644 --- a/tests/sql/test_utf8_exprs.py +++ b/tests/sql/test_utf8_exprs.py @@ -78,7 +78,7 @@ def test_utf8_exprs(): col("a").str.extract("ba.").alias("extract_a"), col("a").str.extract_all("ba.").alias("extract_all_a"), col("a").str.split(r"\s+", regex=True).alias("regexp_split_a"), - col("a").str.replace("ba.", "foo").alias("replace_a"), + col("a").str.replace("ba.", "foo", regex=True).alias("replace_a"), col("a").str.length().alias("length_a"), col("a").str.length_bytes().alias("length_bytes_a"), col("a").str.lower().alias("lower_a"),