From c6fd566a4957d8a1a946e37b57266cb1f37f2933 Mon Sep 17 00:00:00 2001 From: Sergei Turukin Date: Mon, 13 Jan 2025 15:27:44 -0600 Subject: [PATCH 1/2] Add "rlike" as an alias for regexp_like --- datafusion/functions/src/regex/regexplike.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datafusion/functions/src/regex/regexplike.rs b/datafusion/functions/src/regex/regexplike.rs index 1c826b12ef8f..c50f1af36acb 100644 --- a/datafusion/functions/src/regex/regexplike.rs +++ b/datafusion/functions/src/regex/regexplike.rs @@ -35,6 +35,7 @@ use std::sync::{Arc, OnceLock}; #[derive(Debug)] pub struct RegexpLikeFunc { signature: Signature, + aliases: Vec, } impl Default for RegexpLikeFunc { @@ -84,6 +85,7 @@ impl RegexpLikeFunc { vec![TypeSignature::String(2), TypeSignature::String(3)], Volatility::Immutable, ), + aliases: vec![String::from("rlike")], } } } @@ -112,6 +114,10 @@ impl ScalarUDFImpl for RegexpLikeFunc { }) } + fn aliases(&self) -> &[String] { + &self.aliases + } + fn invoke_batch( &self, args: &[ColumnarValue], From 71b05155bed2edc75ee0a30d62e109b1e55ac756 Mon Sep 17 00:00:00 2001 From: Sergei Turukin Date: Tue, 14 Jan 2025 09:45:33 -0600 Subject: [PATCH 2/2] Update docs --- docs/source/user-guide/sql/scalar_functions.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index ac0978683c36..fdb555894427 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -1769,6 +1769,7 @@ The following regular expression functions are supported: - [regexp_like](#regexp_like) - [regexp_match](#regexp_match) - [regexp_replace](#regexp_replace) +- [rlike](#rlike) ### `regexp_count` @@ -1839,6 +1840,10 @@ SELECT regexp_like('aBc', '(b|d)', 'i'); Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) +#### Aliases + +- rlike + ### `regexp_match` Returns the first [regular expression](https://docs.rs/regex/latest/regex/#syntax) matches in a string. @@ -1919,6 +1924,10 @@ SELECT regexp_replace('aBc', '(b|d)', 'Ab\\1a', 'i'); Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) +### `rlike` + +_Alias of [regexp_like](#regexp_like)._ + ## Time and Date Functions - [current_date](#current_date)