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()));
}
}
Aggregations