Github user walterddr commented on a diff in the pull request:
https://github.com/apache/flink/pull/5706#discussion_r175296744
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/logical/FlinkLogicalWindowAggregate.scala
---
@@ -103,6 +106,22 @@ class FlinkLogicalWindowAggregateConverter
FlinkConventions.LOGICAL,
"FlinkLogicalWindowAggregateConverter") {
+ override def matches(call: RelOptRuleCall): Boolean = {
+ val agg = call.rel(0).asInstanceOf[LogicalWindowAggregate]
+
+ // we do not support these functions natively
+ // they have to be converted using the
WindowAggregateReduceFunctionsRule
+ val supported =
agg.getAggCallList.asScala.map(_.getAggregation.getKind).forall {
+ // we support AVG
+ case SqlKind.AVG => true
+ // but none of the other AVG agg functions
+ case k if SqlKind.AVG_AGG_FUNCTIONS.contains(k) => false
+ case _ => true
+ }
+
+ !agg.containsDistinctCall() && supported
--- End diff --
shouldn't the logical rule supports distinct call here? It seems like
previously the error were thrown on the `DataSetWindowAggregateRule` and
`DataStreamWindowAggregateRule` respectively. Any chance we can add a unit-test
to further clarify this change?
---