Search in sources :

Example 1 with Agg

use of io.dingodb.exec.aggregate.Agg 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));
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) Agg(io.dingodb.exec.aggregate.Agg) DingoAggregate(io.dingodb.calcite.rel.DingoAggregate) DingoReduce(io.dingodb.calcite.rel.DingoReduce) Aggregate(org.apache.calcite.rel.core.Aggregate) DingoAggregate(io.dingodb.calcite.rel.DingoAggregate) TupleMapping(io.dingodb.common.table.TupleMapping) DingoExchange(io.dingodb.calcite.rel.DingoExchange)

Aggregations

DingoAggregate (io.dingodb.calcite.rel.DingoAggregate)1 DingoExchange (io.dingodb.calcite.rel.DingoExchange)1 DingoReduce (io.dingodb.calcite.rel.DingoReduce)1 TupleMapping (io.dingodb.common.table.TupleMapping)1 Agg (io.dingodb.exec.aggregate.Agg)1 RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 Aggregate (org.apache.calcite.rel.core.Aggregate)1