Search in sources :

Example 1 with HashAggregateNode

use of org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteReduceHashAggregate rel) {
    AggregateType type = AggregateType.REDUCE;
    RelDataType rowType = rel.getRowType();
    Supplier<List<AccumulatorWrapper<RowT>>> accFactory = expressionFactory.accumulatorsFactory(type, rel.getAggregateCalls(), null);
    RowFactory<RowT> rowFactory = ctx.rowHandler().factory(ctx.getTypeFactory(), rowType);
    HashAggregateNode<RowT> node = new HashAggregateNode<>(ctx, rowType, type, rel.getGroupSets(), accFactory, rowFactory);
    Node<RowT> input = visit(rel.getInput());
    node.register(input);
    return node;
}
Also used : RelDataType(org.apache.calcite.rel.type.RelDataType) List(java.util.List) ArrayUtils.asList(org.apache.ignite.internal.util.ArrayUtils.asList) HashAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Example 2 with HashAggregateNode

use of org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteSingleHashAggregate rel) {
    AggregateType type = AggregateType.SINGLE;
    RelDataType rowType = rel.getRowType();
    RelDataType inputType = rel.getInput().getRowType();
    Supplier<List<AccumulatorWrapper<RowT>>> accFactory = expressionFactory.accumulatorsFactory(type, rel.getAggCallList(), inputType);
    RowFactory<RowT> rowFactory = ctx.rowHandler().factory(ctx.getTypeFactory(), rowType);
    HashAggregateNode<RowT> node = new HashAggregateNode<>(ctx, rowType, type, rel.getGroupSets(), accFactory, rowFactory);
    Node<RowT> input = visit(rel.getInput());
    node.register(input);
    return node;
}
Also used : RelDataType(org.apache.calcite.rel.type.RelDataType) List(java.util.List) ArrayUtils.asList(org.apache.ignite.internal.util.ArrayUtils.asList) HashAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Example 3 with HashAggregateNode

use of org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteMapHashAggregate rel) {
    AggregateType type = AggregateType.MAP;
    RelDataType rowType = rel.getRowType();
    RelDataType inputType = rel.getInput().getRowType();
    Supplier<List<AccumulatorWrapper<RowT>>> accFactory = expressionFactory.accumulatorsFactory(type, rel.getAggCallList(), inputType);
    RowFactory<RowT> rowFactory = ctx.rowHandler().factory(ctx.getTypeFactory(), rowType);
    HashAggregateNode<RowT> node = new HashAggregateNode<>(ctx, rowType, type, rel.getGroupSets(), accFactory, rowFactory);
    Node<RowT> input = visit(rel.getInput());
    node.register(input);
    return node;
}
Also used : RelDataType(org.apache.calcite.rel.type.RelDataType) List(java.util.List) ArrayUtils.asList(org.apache.ignite.internal.util.ArrayUtils.asList) HashAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Aggregations

List (java.util.List)3 RelDataType (org.apache.calcite.rel.type.RelDataType)3 AggregateType (org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)3 HashAggregateNode (org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode)3 ArrayUtils.asList (org.apache.ignite.internal.util.ArrayUtils.asList)3