Search in sources :

Example 1 with AggregateType

use of org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteSingleSortAggregate 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);
    SortAggregateNode<RowT> node = new SortAggregateNode<>(ctx, rowType, type, rel.getGroupSet(), accFactory, rowFactory, expressionFactory.comparator(rel.collation()));
    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) SortAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.SortAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Example 2 with AggregateType

use of org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType 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 3 with AggregateType

use of org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteReduceSortAggregate 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);
    SortAggregateNode<RowT> node = new SortAggregateNode<>(ctx, rowType, type, rel.getGroupSet(), accFactory, rowFactory, expressionFactory.comparator(rel.collation()));
    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) SortAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.SortAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Example 4 with AggregateType

use of org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType in project ignite-3 by apache.

the class LogicalRelImplementor method visit.

/**
 * {@inheritDoc}
 */
@Override
public Node<RowT> visit(IgniteMapSortAggregate 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);
    SortAggregateNode<RowT> node = new SortAggregateNode<>(ctx, rowType, type, rel.getGroupSet(), accFactory, rowFactory, expressionFactory.comparator(rel.collation()));
    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) SortAggregateNode(org.apache.ignite.internal.sql.engine.exec.rel.SortAggregateNode) AggregateType(org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType)

Example 5 with AggregateType

use of org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateType 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)

Aggregations

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