fsk119 commented on code in PR #27039:
URL: https://github.com/apache/flink/pull/27039#discussion_r2434368534


##########
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2614,6 +2618,27 @@ private SqlNode registerFrom(
                         scopes.put(node, getSelectScope(call1.operand(0)));
                         return newNode;
                     }
+
+                    // Related to CALCITE-4077
+                    // ----- FLINK MODIFICATION BEGIN -----
+                    FlinkSqlCallBinding binding =
+                            new FlinkSqlCallBinding(this, getEmptyScope(), 
call1);
+                    if (op instanceof SqlVectorSearchTableFunction
+                            && binding.operand(0)
+                                    .isA(
+                                            new HashSet<>(
+                                                    
Collections.singletonList(SqlKind.SELECT)))) {
+                        boolean queryColumnIsNotLiteral =
+                                binding.operand(2).getKind() != 
SqlKind.LITERAL;
+                        if (!queryColumnIsNotLiteral && !lateral) {
+                            throw new ValidationException(
+                                    "The query column is not literal, please 
use LATERAL TABLE to run VECTOR_SEARCH.");
+                        }
+                        SqlValidatorScope scope = getSelectScope((SqlSelect) 
binding.operand(0));

Review Comment:
   It requires. Because line 2618 uses SqlCall to get operand(its return type 
is  `<S extends SqlNode> S` ), but here we uses SqlCallBinding to get 
operand(its return type is `SqlNode`). Therefore, we still need cast here. 0.0
   
   We can not use SqlCall to extract operand because `VECTOR_SEARCH` allows 
user to use named argument, which means the operands is out of order and we 
need to use the name to reorder the operands.



-- 
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]

Reply via email to