public Double getMaxRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getMaxRowCount(rel.getInput()); if (rowCount == null) { rowCount = Double.POSITIVE_INFINITY; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
public Double getMaxRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getMaxRowCount(rel.getInput()); if (rowCount == null) { rowCount = Double.POSITIVE_INFINITY; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
public Double getMinRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getMinRowCount(rel.getInput()); if (rowCount == null) { rowCount = 0D; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
public Double getMinRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getMinRowCount(rel.getInput()); if (rowCount == null) { rowCount = 0D; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
public Double getRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getRowCount(rel.getInput()); if (rowCount == null) { return null; } if (rel.offset instanceof RexDynamicParam) { return rowCount; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { if (rel.fetch instanceof RexDynamicParam) { return rowCount; } final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
public Double getRowCount(EnumerableLimit rel, RelMetadataQuery mq) { Double rowCount = mq.getRowCount(rel.getInput()); if (rowCount == null) { return null; } if (rel.offset instanceof RexDynamicParam) { return rowCount; } final int offset = rel.offset == null ? 0 : RexLiteral.intValue(rel.offset); rowCount = Math.max(rowCount - offset, 0D); if (rel.fetch != null) { if (rel.fetch instanceof RexDynamicParam) { return rowCount; } final int limit = RexLiteral.intValue(rel.fetch); if (limit < rowCount) { return (double) limit; } } return rowCount; }
private PlannerOp planLimit(EnumerableLimit op, RelDataType rowType) { PlannerOp input = convertRelNode(op.getInput(), rowType, false); CompiledSQLExpression maxRows = SQLExpressionCompiler.compileExpression(op.fetch); CompiledSQLExpression offset = SQLExpressionCompiler.compileExpression(op.offset); return new LimitOp(input, maxRows, offset); }
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { final BlockBuilder builder = new BlockBuilder(); final EnumerableRel child = (EnumerableRel) getInput(); final Result result = implementor.visitChild(this, 0, child, pref); final PhysType physType =
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { final BlockBuilder builder = new BlockBuilder(); final EnumerableRel child = (EnumerableRel) getInput(); final Result result = implementor.visitChild(this, 0, child, pref); final PhysType physType =