Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ datafusion-session = { git = "https://github.com/apache/datafusion", branch = "b
log = "^0.4"
num-traits = { version = "0.2" }
rand = "0.9"
regex = "1"
regex-syntax = "0.8"
serde = "1"
serde_json = "1"
sha2 = "^0.11.0"
Expand Down
2 changes: 2 additions & 0 deletions crates/spark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ log = { workspace = true }
num-traits = { workspace = true }
percent-encoding = "2.3.2"
rand = { workspace = true }
regex = { workspace = true }
regex-syntax = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha1 = "0.11"
Expand Down
8 changes: 8 additions & 0 deletions crates/spark/src/function/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod like;
pub mod luhn_check;
pub mod make_valid_utf8;
pub mod quote;
pub mod regexp_extract;
pub mod soundex;
pub mod space;
pub mod substring;
Expand Down Expand Up @@ -48,6 +49,7 @@ make_udf_function!(soundex::SparkSoundex, soundex);
make_udf_function!(make_valid_utf8::SparkMakeValidUtf8, make_valid_utf8);
make_udf_function!(is_valid_utf8::SparkIsValidUtf8, is_valid_utf8);
make_udf_function!(quote::SparkQuote, quote);
make_udf_function!(regexp_extract::SparkRegexpExtract, regexp_extract);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every other function in this module also has an export_functions! entry in expr_fn. regexp_extract does not, so datafusion_spark::expr_fn::regexp_extract is missing for the DataFrame API.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the export_functions! entry in d57453e.

make_udf_function!(to_binary::SparkToBinary, to_binary);
make_udf_function!(to_binary::SparkTryToBinary, try_to_binary);

Expand Down Expand Up @@ -141,6 +143,11 @@ pub mod expr_fn {
"Returns str enclosed by single quotes and each instance of single quote in it is preceded by a backslash",
str
));
export_functions!((
regexp_extract,
"Extracts the group `idx` (default 1, 0 for the whole match) of the first match of `regexp` in `str`.",
str regexp idx
));
export_functions!((
to_binary,
"Converts the input str to a binary value based on the supplied fmt, which must be a case-insensitive literal of 'hex', 'utf-8', 'utf8' or 'base64'. Defaults to 'hex'.",
Expand Down Expand Up @@ -174,6 +181,7 @@ pub fn functions() -> Vec<Arc<ScalarUDF>> {
make_valid_utf8(),
is_valid_utf8(),
quote(),
regexp_extract(),
to_binary(),
try_to_binary(),
]
Expand Down
Loading
Loading