Search in sources :

Example 1 with Limit

use of org.apache.drill.common.logical.data.Limit in project drill by apache.

the class DrillLimitRel method implement.

@Override
public LogicalOperator implement(DrillImplementor implementor) {
    LogicalOperator inputOp = implementor.visitChild(this, 0, getInput());
    // First offset to include into results (inclusive). Null implies it is starting from offset 0
    int first = offset != null ? Math.max(0, RexLiteral.intValue(offset)) : 0;
    // Last offset to stop including into results (exclusive), translating fetch row counts into an offset.
    // Null value implies including entire remaining result set from first offset
    Integer last = fetch != null ? Math.max(0, RexLiteral.intValue(fetch)) + first : null;
    Limit limit = new Limit(first, last);
    limit.setInput(inputOp);
    return limit;
}
Also used : LogicalOperator(org.apache.drill.common.logical.data.LogicalOperator) Limit(org.apache.drill.common.logical.data.Limit)

Aggregations

Limit (org.apache.drill.common.logical.data.Limit)1 LogicalOperator (org.apache.drill.common.logical.data.LogicalOperator)1