Search in sources :

Example 1 with OffsetNode

use of com.facebook.presto.sql.planner.plan.OffsetNode in project presto by prestodb.

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.getSourceLocation(), parent.getId(), child.getSource(), count, parent.getStep()))));
}
Also used : LimitNode(com.facebook.presto.spi.plan.LimitNode) OffsetNode(com.facebook.presto.sql.planner.plan.OffsetNode)

Aggregations

LimitNode (com.facebook.presto.spi.plan.LimitNode)1 OffsetNode (com.facebook.presto.sql.planner.plan.OffsetNode)1