lvyanquan commented on code in PR #4505:
URL: https://github.com/apache/flink-cdc/pull/4505#discussion_r3812586120
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/TransformParser.java:
##########
@@ -240,6 +248,67 @@ private static RelNode sqlToRel(
return relRoot.rel;
}
+ private static SqlNode resolveUserDefinedFunctions(
+ SqlNode sqlNode, List<SqlFunction> udfFunctions) {
+ return sqlNode.accept(
+ new SqlShuttle() {
+ @Override
+ public SqlNode visit(SqlCall call) {
+ SqlNode visited = super.visit(call);
+ if (visited instanceof SqlBasicCall) {
+ SqlBasicCall basicCall = (SqlBasicCall) visited;
+ udfFunctions.stream()
Review 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 is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]