[hotfix][runtime] Respect UDF precedence during type validation - #4505
Merged
lvyanquan merged 2 commits intoAug 20, 2026
Conversation
haruki-830
force-pushed
the
hotfix/udf-validation-precedence
branch
from
August 19, 2026 05:38
bce9c49 to
d107204
Compare
lvyanquan
reviewed
Aug 19, 2026
| SqlNode visited = super.visit(call); | ||
| if (visited instanceof SqlBasicCall) { | ||
| SqlBasicCall basicCall = (SqlBasicCall) visited; | ||
| udfFunctions.stream() |
Contributor
There was a problem hiding this comment.
resolveUserDefinedFunctions matches every SqlBasicCall solely by operator name, including structural operators. Since UDF names are not restricted, registering a UDF named as causes id AS alias to have its AS operator replaced by the UDF, so Calcite validates it as a function call rather than an alias expression.
Please restrict rebinding to actual function-call syntax and leave structural/special operators such as AS intact.
if (basicCall.getOperator().getSyntax().family
!= SqlSyntax.FUNCTION) {
return visited;
}
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 is a follow-up to #4492 (FLINK-40240). It aligns Calcite type validation with Janino code generation by giving same-named UDFs precedence over built-in functions.
Verifying this change
Documentation
This PR does not introduce a new feature.