Skip to content

Commit de51ea3

Browse files
committed
feat: support Binary for regrep_replace
1 parent ea9144e commit de51ea3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

datafusion/expr/src/built_in_function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,8 +1398,8 @@ macro_rules! make_utf8_to_return_type {
13981398
($FUNC:ident, $largeUtf8Type:expr, $utf8Type:expr) => {
13991399
fn $FUNC(arg_type: &DataType, name: &str) -> Result<DataType> {
14001400
Ok(match arg_type {
1401-
DataType::LargeUtf8 => $largeUtf8Type,
1402-
DataType::Utf8 => $utf8Type,
1401+
DataType::LargeUtf8 | DataType::LargeBinary=> $largeUtf8Type,
1402+
DataType::Utf8 | DataType::Binary => $utf8Type,
14031403
DataType::Null => DataType::Null,
14041404
DataType::Dictionary(_, value_type) => match **value_type {
14051405
DataType::LargeUtf8 => $largeUtf8Type,

datafusion/sqllogictest/test_files/functions.slt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,11 @@ SELECT regexp_replace('foobar', 'bar', 'xx', 'gi')
678678
----
679679
fooxx
680680

681+
query T
682+
SELECT regexp_replace(arrow_cast('foobar', 'Binary'), arrow_cast('bar', 'Binary'), arrow_cast('xx', 'Binary'), arrow_cast('gi', 'Binary'))
683+
----
684+
fooxx
685+
681686
query T
682687
SELECT regexp_replace(arrow_cast('foobar', 'Dictionary(Int32, Utf8)'), 'bar', 'xx', 'gi')
683688
----

0 commit comments

Comments
 (0)