use of io.dingodb.calcite.rel.DingoReduce in project dingo by dingodb.
the class DingoAggregateRule method onMatch.
@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
Aggregate rel = call.rel(0);
// AVG must be transformed to SUM/COUNT before.
if (rel.getAggCallList().stream().anyMatch(agg -> agg.getAggregation().getKind() == SqlKind.AVG)) {
return;
}
RelOptCluster cluster = rel.getCluster();
TupleMapping keyMapping = getAggKeys(rel);
List<Agg> aggList = getAggList(rel);
call.transformTo(new DingoReduce(cluster, rel.getTraitSet().replace(DingoConventions.ROOT), new DingoExchange(cluster, rel.getTraitSet().replace(DingoConventions.PARTITIONED), new DingoAggregate(cluster, rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), convert(rel.getInput(), DingoConventions.DISTRIBUTED), keyMapping, aggList, rel.getRowType())), keyMapping, aggList));
}
Aggregations