Search in sources :

Example 1 with OffsetNode

use of io.trino.sql.planner.plan.OffsetNode in project trino by trinodb.

the class PushLimitThroughOffset method apply.

@Override
public Result apply(LimitNode parent, Captures captures, Context context) {
    OffsetNode child = captures.get(CHILD);
    long count;
    try {
        count = addExact(parent.getCount(), child.getCount());
    } catch (ArithmeticException e) {
        return Result.empty();
    }
    return Result.ofPlanNode(child.replaceChildren(ImmutableList.of(new LimitNode(parent.getId(), child.getSource(), count, parent.getTiesResolvingScheme(), parent.isPartial(), parent.getPreSortedInputs()))));
}
Also used : LimitNode(io.trino.sql.planner.plan.LimitNode) OffsetNode(io.trino.sql.planner.plan.OffsetNode)

Aggregations

LimitNode (io.trino.sql.planner.plan.LimitNode)1 OffsetNode (io.trino.sql.planner.plan.OffsetNode)1