fix: Support on all-literal RLIKE expression#3647
Merged
martin-g merged 8 commits intoapache:mainfrom Mar 12, 2026
Merged
Conversation
coderfender
reviewed
Mar 8, 2026
Contributor
coderfender
left a comment
There was a problem hiding this comment.
Thank you for adding additional support. Left couple of comments
| let is_match = match scalar { | ||
| ScalarValue::Utf8(Some(s)) => self.pattern.is_match(s.as_str()), | ||
| ScalarValue::LargeUtf8(Some(s)) => self.pattern.is_match(s.as_str()), | ||
| ScalarValue::Utf8View(Some(s)) => self.pattern.is_match(s.as_str()), |
Contributor
There was a problem hiding this comment.
@0lai0 would we ever get a UTF8View input from the spark side?
Contributor
Author
There was a problem hiding this comment.
Yes, On the current Spark -> Comet proto -> native planner path, string literals are deserialized as ScalarValue::Utf8. So I think keeping Utf8 handling here is necessary.
Let me know if I missed anything.
| ScalarValue::LargeUtf8(Some(s)) => self.pattern.is_match(s.as_str()), | ||
| ScalarValue::Utf8View(Some(s)) => self.pattern.is_match(s.as_str()), | ||
| _ => { | ||
| return internal_err!( |
andygrove
reviewed
Mar 10, 2026
Comment on lines
+25
to
+26
| #[cfg(test)] | ||
| use datafusion::physical_expr::expressions::Literal; |
Member
There was a problem hiding this comment.
The import should just be moved inside mod test which is already behind the #[cfg(test)] guard
Contributor
Author
|
Thanks @andygrove for the review. PR updated. |
martin-g
reviewed
Mar 11, 2026
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
martin-g
approved these changes
Mar 11, 2026
Member
|
Thank you, @0lai0 ! |
Contributor
Author
|
Thanks @coderfender , @andygrove and @martin-g |
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.
Which issue does this PR close?
Closes #3343
Rationale for this change
When
ConstantFoldingis disabled, all-literal RLIKE expressions crash the native engine with a misleading error. The engine should handle scalar literals gracefully.What changes are included in this PR?
How are these changes tested?
ConstantFoldingdisabledrlike_enabled.sqltest now passes./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite rlike_enabled" -Dtest=none