Search in sources :

Example 1 with IgniteLimit

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

the class SortConverterRule method onMatch.

/**
 * {@inheritDoc}
 */
@Override
public void onMatch(RelOptRuleCall call) {
    final Sort sort = call.rel(0);
    RelOptCluster cluster = sort.getCluster();
    if (sort.fetch != null || sort.offset != null) {
        RelTraitSet traits = cluster.traitSetOf(IgniteConvention.INSTANCE).replace(sort.getCollation()).replace(IgniteDistributions.single());
        call.transformTo(new IgniteLimit(cluster, traits, convert(sort.getInput(), traits), sort.offset, sort.fetch));
    } else {
        RelTraitSet outTraits = cluster.traitSetOf(IgniteConvention.INSTANCE).replace(sort.getCollation());
        RelTraitSet inTraits = cluster.traitSetOf(IgniteConvention.INSTANCE);
        RelNode input = convert(sort.getInput(), inTraits);
        call.transformTo(new IgniteSort(cluster, outTraits, input, sort.getCollation()));
    }
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) IgniteLimit(org.apache.ignite.internal.sql.engine.rel.IgniteLimit) RelNode(org.apache.calcite.rel.RelNode) LogicalSort(org.apache.calcite.rel.logical.LogicalSort) IgniteSort(org.apache.ignite.internal.sql.engine.rel.IgniteSort) Sort(org.apache.calcite.rel.core.Sort) IgniteSort(org.apache.ignite.internal.sql.engine.rel.IgniteSort) RelTraitSet(org.apache.calcite.plan.RelTraitSet)

Aggregations

RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 RelTraitSet (org.apache.calcite.plan.RelTraitSet)1 RelNode (org.apache.calcite.rel.RelNode)1 Sort (org.apache.calcite.rel.core.Sort)1 LogicalSort (org.apache.calcite.rel.logical.LogicalSort)1 IgniteLimit (org.apache.ignite.internal.sql.engine.rel.IgniteLimit)1 IgniteSort (org.apache.ignite.internal.sql.engine.rel.IgniteSort)1