lihaosky commented on code in PR #26553:
URL: https://github.com/apache/flink/pull/26553#discussion_r2098713382


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/FlinkCalciteSqlValidator.java:
##########
@@ -371,7 +374,14 @@ protected void addToSelectList(
         final SqlBasicCall call = (SqlBasicCall) node;
         final SqlOperator operator = call.getOperator();
 
-        if (operator instanceof SqlWindowTableFunction) {
+        if (node instanceof SqlExplicitModelCall) {
+            // Convert it so that model can be accessed in planner. 
SqlExplicitModelCall
+            // from parser can't access model.
+            SqlExplicitModelCall modelCall = (SqlExplicitModelCall) node;
+            return new SqlModelCall(modelCall);
+        }
+
+        if (operator instanceof SqlWindowTableFunction || operator instanceof 
SqlMLTableFunction) {

Review Comment:
   Sure. Will add a test to 
`flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/stream/sql/ColumnExpansionTest.java`
 after working E2E. Created https://issues.apache.org/jira/browse/FLINK-37819



##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/FlinkCalciteSqlValidator.java:
##########
@@ -371,7 +374,14 @@ protected void addToSelectList(
         final SqlBasicCall call = (SqlBasicCall) node;
         final SqlOperator operator = call.getOperator();
 
-        if (operator instanceof SqlWindowTableFunction) {
+        if (node instanceof SqlExplicitModelCall) {
+            // Convert it so that model can be accessed in planner. 
SqlExplicitModelCall
+            // from parser can't access model.
+            SqlExplicitModelCall modelCall = (SqlExplicitModelCall) node;

Review Comment:
   Getting model here should be fine. But `SqlExplicitModelCall` with model 
identifier expects the model to exist so we should enforce that here. If there 
are cases where model doesn't need to exist in other cases, we can revisit?



##########
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2573,7 +2575,7 @@ private SqlNode registerFrom(
                 if (operand instanceof SqlBasicCall) {
                     final SqlBasicCall call1 = (SqlBasicCall) operand;
                     final SqlOperator op = call1.getOperator();
-                    if (op instanceof SqlWindowTableFunction
+                    if ((op instanceof SqlWindowTableFunction || op instanceof 
SqlMLTableFunction)

Review Comment:
   Yeah. This one doesn't seem to have effect. The first select scope should be 
used when validating descriptor's operands. I made changes there



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to