-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix pattern handling in regexp_match function #1065
Conversation
3 => { | ||
let values = downcast_string_arg!(args[0], "string", T); | ||
let regex = downcast_string_arg!(args[1], "pattern", T); | ||
let flags = Some(downcast_string_arg!(args[2], "flags", T)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is the fix, index was 1 before the fix.
Found this during the arrow2 migration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 => { | ||
let values = downcast_string_arg!(args[0], "string", T); | ||
let regex = downcast_string_arg!(args[1], "pattern", T); | ||
compute::regexp_match(values, regex, None).map_err(DataFusionError::ArrowError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.rs/arrow/5.5.0/arrow/compute/kernels/regexp/fn.regexp_match.html for anyone else who may be looking
let mut expected_builder = ListBuilder::new(elem_builder); | ||
expected_builder.values().append_value("a").unwrap(); | ||
expected_builder.append(true).unwrap(); | ||
expected_builder.values().append_value("a").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
expected_builder.append(true).unwrap(); | ||
expected_builder.values().append_value("b").unwrap(); | ||
expected_builder.append(true).unwrap(); | ||
expected_builder.values().append_value("b").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks @houqp |
Rationale for this change
We are accessing the pattern flag using the wrong index.
What changes are included in this PR?
Fixed index and added tests. Also refactored code to make it more readable.
Are there any user-facing changes?
no