MartijnVisser commented on code in PR #29835:
URL: https://github.com/apache/flink/pull/29835#discussion_r4772666163


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/optimize/ComparableTypeValidator.java:
##########
@@ -124,6 +133,80 @@ public static void validate(final List<RelNode> roots) {
         roots.forEach(root -> new PlanChecker().go(root));
     }
 
+    /**
+     * Throws a {@link ValidationException} if a validated SQL call compares 
values of a type that
+     * is not comparable.
+     */
+    public static void validateComparison(
+            final SqlCall call, final SqlValidator validator, final 
SqlValidatorScope scope) {
+        if (call.isA(EQUALITY_OPERATORS)) {
+            checkComparison(call, validator, scope, EQUALITY);
+        } else if (call.isA(ORDER_OPERATORS)) {
+            checkComparison(call, validator, scope, ORDER);
+        } else if (call.getKind() == SqlKind.FILTER) {

Review Comment:
   I think this walk belongs in `FlinkCalciteSqlValidator#validateCall`, so 
every check there covers FILTER. With FLINK-41572 on top, `COUNT(*) FILTER 
(WHERE id = s)` still misses its new check.



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