Skip to content

Commit 02a8e19

Browse files
rampage644Denys Tsomenko
authored andcommitted
Add "rlike" as an alias for regexp_like (#2)
* Add "rlike" as an alias for regexp_like * Update docs
1 parent 82a8cfc commit 02a8e19

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

datafusion/functions/src/regex/regexplike.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ use datafusion_expr::{
3333
use datafusion_macros::user_doc;
3434

3535
use std::any::Any;
36-
use std::sync::Arc;
36+
use std::sync::{Arc, OnceLock};
37+
38+
#[derive(Debug)]
39+
pub struct RegexpLikeFunc {
40+
signature: Signature,
41+
aliases: Vec<String>,
42+
}
3743

3844
#[user_doc(
3945
doc_section(label = "Regular Expression Functions"),
@@ -95,6 +101,7 @@ impl RegexpLikeFunc {
95101
],
96102
Volatility::Immutable,
97103
),
104+
aliases: vec![String::from("rlike")],
98105
}
99106
}
100107
}
@@ -123,6 +130,10 @@ impl ScalarUDFImpl for RegexpLikeFunc {
123130
})
124131
}
125132

133+
fn aliases(&self) -> &[String] {
134+
&self.aliases
135+
}
136+
126137
fn invoke_with_args(
127138
&self,
128139
args: datafusion_expr::ScalarFunctionArgs,

docs/source/user-guide/sql/scalar_functions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,7 @@ The following regular expression functions are supported:
17961796
- [regexp_like](#regexp_like)
17971797
- [regexp_match](#regexp_match)
17981798
- [regexp_replace](#regexp_replace)
1799+
- [rlike](#rlike)
17991800

18001801
### `regexp_count`
18011802

@@ -1866,6 +1867,10 @@ SELECT regexp_like('aBc', '(b|d)', 'i');
18661867

18671868
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs)
18681869

1870+
#### Aliases
1871+
1872+
- rlike
1873+
18691874
### `regexp_match`
18701875

18711876
Returns the first [regular expression](https://docs.rs/regex/latest/regex/#syntax) matches in a string.
@@ -1946,6 +1951,10 @@ SELECT regexp_replace('aBc', '(b|d)', 'Ab\\1a', 'i');
19461951

19471952
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs)
19481953

1954+
### `rlike`
1955+
1956+
_Alias of [regexp_like](#regexp_like)._
1957+
19491958
## Time and Date Functions
19501959

19511960
- [current_date](#current_date)

0 commit comments

Comments
 (0)