xuzifu666 commented on code in PR #5019:
URL: https://github.com/apache/calcite/pull/5019#discussion_r3425700812


##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -1250,6 +1251,7 @@ void populate2() {
           NotJsonImplementor.of(
               new MethodImplementor(BuiltInMethod.IS_JSON_SCALAR.method,
                   NullPolicy.NONE, false)));
+      define(FILTER, new FilterImplementor());

Review Comment:
   In my view restriction is in SqlOverOperator.validateCall(), which is only 
called for window functions (the OVER operator).
   ```
   if (hasFilter && aggCall.getKind() == SqlKind.COUNT
         && aggCall.getFunctionQuantifier() != null) {
       throw validator.newValidationError(aggCall, RESOURCE.overNonAggregate());
     }
   ```
   1. Normal aggregates bypass SqlOverOperator entirely—they're validated by 
their own operator (e.g., SqlCountAggFunction)
   2. Window aggregates MUST go through SqlOverOperator because they have the 
OVER clause
   3. Our restriction is injected into the SqlOverOperator validation, so it 
naturally only affects window functions



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