Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: issue_9285: port builtin reg function into datafusion-function-* (1/3 regexpmatch) #9329

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

Lordworms
Copy link
Contributor

…* crate (1/3: RegexpMatch part)

Which issue does this PR close?

#9328

Closes #.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions physical-expr Physical Expressions core Core DataFusion crate and removed sql SQL Planner labels Feb 23, 2024
@alamb alamb added the api change Changes the API exposed to users of the crate label Feb 27, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you very much @Lordworms -- this PR looks great to me and it is very close I think. I left some small suggestions and then I think this will be ready to go

use std::sync::Arc;

#[cfg(feature = "regex_expressions")]
macro_rules! invoke_on_array_if_regex_expressions_feature_flag {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these macros are needed here because the entire module is not included if the regex_expressions module is not compiled in.

regexp::regexp_match(values, regex, Some(flags))
.map_err(|e| arrow_datafusion_err!(e))
}
other => internal_err!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
other => internal_err!(
other => exec_err!(


Ok(())
}
// #[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks to me like regexp_match is already tested in https://github.com/apache/arrow-datafusion/blob/c439bc73b6a9ba9efa4c8a9b5d2fb6111e660e74/datafusion/sqllogictest/test_files/regexp.slt#L128-L215 so I think we can simply remove this test

Bonus points would be to port it to .slt

(there is no reason to leave it in and commented out)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would port it to .slt

@@ -536,7 +536,7 @@ impl From<&protobuf::ScalarFunction> for BuiltinScalarFunction {
ScalarFunction::Lpad => Self::Lpad,
ScalarFunction::Random => Self::Random,
ScalarFunction::RegexpLike => Self::RegexpLike,
ScalarFunction::RegexpMatch => Self::RegexpMatch,
//ScalarFunction::RegexpMatch => Self::RegexpMatch,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//ScalarFunction::RegexpMatch => Self::RegexpMatch,

I think removing it entirely would be better

@@ -1518,7 +1518,7 @@ impl TryFrom<&BuiltinScalarFunction> for protobuf::ScalarFunction {
BuiltinScalarFunction::Random => Self::Random,
BuiltinScalarFunction::Uuid => Self::Uuid,
BuiltinScalarFunction::RegexpLike => Self::RegexpLike,
BuiltinScalarFunction::RegexpMatch => Self::RegexpMatch,
//BuiltinScalarFunction::RegexpMatch => Self::RegexpMatch,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//BuiltinScalarFunction::RegexpMatch => Self::RegexpMatch,

@Lordworms
Copy link
Contributor Author

Got it, I will fix this later today

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Feb 27, 2024
@Lordworms Lordworms force-pushed the issue_9285_regx_match branch from 13a7425 to c3e3a87 Compare February 28, 2024 00:51
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @Lordworms - this looks great to me

@alamb alamb merged commit e622409 into apache:main Feb 28, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants