use of org.apache.flink.table.planner.functions.sql.internal.SqlAuxiliaryGroupAggFunction in project flink by apache.
the class FlinkAggregateRemoveRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
final Aggregate aggregate = call.rel(0);
final RelNode input = call.rel(1);
if (aggregate.getGroupCount() == 0 || aggregate.indicator || aggregate.getGroupType() != Aggregate.Group.SIMPLE) {
return false;
}
for (AggregateCall aggCall : aggregate.getAggCallList()) {
SqlKind aggCallKind = aggCall.getAggregation().getKind();
// TODO supports more AggregateCalls
boolean isAllowAggCall = aggCallKind == SqlKind.SUM || aggCallKind == SqlKind.MIN || aggCallKind == SqlKind.MAX || aggCall.getAggregation() instanceof SqlAuxiliaryGroupAggFunction;
if (!isAllowAggCall || aggCall.filterArg >= 0 || aggCall.getArgList().size() != 1) {
return false;
}
}
final RelMetadataQuery mq = call.getMetadataQuery();
return SqlFunctions.isTrue(mq.areColumnsUnique(input, aggregate.getGroupSet()));
}
Aggregations