fix pattern handling in regexp_match function#1065
Merged
alamb merged 1 commit intoapache:masterfrom Oct 5, 2021
Merged
Conversation
houqp
commented
Oct 1, 2021
| 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)); |
Member
Author
There was a problem hiding this comment.
this line is the fix, index was 1 before the fix.
Member
Author
|
Found this during the arrow2 migration. |
alamb
approved these changes
Oct 5, 2021
| 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) |
Contributor
There was a problem hiding this comment.
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(); |
| expected_builder.append(true).unwrap(); | ||
| expected_builder.values().append_value("b").unwrap(); | ||
| expected_builder.append(true).unwrap(); | ||
| expected_builder.values().append_value("b").unwrap(); |
Contributor
|
Thanks @houqp |
unkloud
pushed a commit
to unkloud/datafusion
that referenced
this pull request
Mar 23, 2025
…1065) * minor: refactor UnaryExpr handling to make more concise * add documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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