[hotfix][runtime] Return UNKNOWN for null regex LIKE predicates#4483
Open
wolfkill wants to merge 1 commit into
Open
[hotfix][runtime] Return UNKNOWN for null regex LIKE predicates#4483wolfkill wants to merge 1 commit into
wolfkill wants to merge 1 commit into
Conversation
Contributor
|
Hi @wolfkill, I noticed that this PR overlaps with an effort I’m currently working on. This PR fixes NULL handling for the legacy two-argument regex Since the changes touch related runtime functions and expression compilation paths, would you be willing to review my PR as well? I’d especially appreciate your feedback on compatibility with the existing regex behavior and how we should coordinate the overlapping changes. |
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.
What is the purpose of this pull request?
This PR fixes nullable transform
LIKE/NOT LIKEpredicates that are translated to the two-argument regex helpers.The three-argument SQL
LIKEhelper already returns SQL UNKNOWN (null) when any operand is null. The regex-style two-argument helper instead calledPattern.matcher(...)directly and threw an NPE when the input string was null. This caused nullable transform predicates such asname like 'A.*'to fail during evaluation instead of producing UNKNOWN.Brief change log
Booleanfrom the two-argument regexlike/notLikehelpers.nullwhen the input string or regex pattern is null.LogicalFunctions.not(...)for nullablenotLikesemantics.Verifying this change
This change added tests and can be verified as follows:
StringFunctionsTestfor nullable two-argument regexLIKE/NOT LIKEoperands.JaninoCompilerTestfor translated nullableLIKE/NOT LIKEpredicates.mvn -U -pl flink-cdc-runtime -am -Dtest=JaninoCompilerTest#testTranslatedLikePredicateReturnsUnknownForNullOperand -DfailIfNoTests=false -Dspotless.check.skip=true -Dcheckstyle.skip=true testNullPointerExceptionfromStringFunctions.like(StringFunctions.java:70).mvn -pl flink-cdc-runtime -am -Dtest=JaninoCompilerTest#testTranslatedLikePredicateReturnsUnknownForNullOperand -DfailIfNoTests=false -Dspotless.check.skip=true -Dcheckstyle.skip=true testmvn -pl flink-cdc-runtime -am -Dtest=StringFunctionsTest,JaninoCompilerTest -DfailIfNoTests=false -Dspotless.check.skip=true -Dcheckstyle.skip=true testmvn -pl flink-cdc-runtime -am -DfailIfNoTests=false -Dspotless.check.skip=true -Dcheckstyle.skip=true testmvn -pl flink-cdc-runtime -am -DskipTests testDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: OpenAI Codex