fsk119 commented on code in PR #27039:
URL: https://github.com/apache/flink/pull/27039#discussion_r2434376303
##########
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) {
Review Comment:
`LATERAL` is not always needed if the SqlCall doesn't contain correlation.
For exmaple, users can use the following statement to search.
```
SELECT * FROM TABLE(VECTOR_SEARCH(TABLE VectorTable, DESCRIPTOR(`g`),
ARRAY[1.5, 2.0], 10))
```
Here, the query input is `ARRAY[1.5, 2.0]`.
CC
https://github.com/apache/flink/blob/06c61b8c363ff4cb53e992428fa716a3c008bb6f/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/stream/sql/VectorSearchTableFunctionTest.java#L95
--
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]