@Override public ILogicalOperator visitLimitOperator(LimitOperator op, Void arg) throws AlgebricksException { return new LimitOperator(deepCopyExpressionRef(op.getMaxObjects()).getValue(), deepCopyExpressionRef(op.getOffset()).getValue(), op.isTopmostLimitOp()); }
@Override public Pair<ILogicalOperator, LogicalVariable> visit(LimitClause lc, Mutable<ILogicalOperator> tupSource) throws CompilationException { SourceLocation sourceLoc = lc.getSourceLocation(); LimitOperator opLim; Pair<ILogicalExpression, Mutable<ILogicalOperator>> p1 = langExprToAlgExpression(lc.getLimitExpr(), tupSource); ILogicalExpression maxObjectsExpr = createLimitOffsetValueExpression(p1.first, lc.getLimitExpr().getSourceLocation()); Expression offset = lc.getOffset(); if (offset != null) { Pair<ILogicalExpression, Mutable<ILogicalOperator>> p2 = langExprToAlgExpression(offset, p1.second); ILogicalExpression offsetExpr = createLimitOffsetValueExpression(p2.first, lc.getOffset().getSourceLocation()); opLim = new LimitOperator(maxObjectsExpr, offsetExpr); opLim.getInputs().add(p2.second); opLim.setSourceLocation(sourceLoc); } else { opLim = new LimitOperator(maxObjectsExpr); opLim.getInputs().add(p1.second); opLim.setSourceLocation(sourceLoc); } return new Pair<>(opLim, null); }
@Override public ILogicalOperator visitLimitOperator(LimitOperator op, ILogicalOperator arg) throws AlgebricksException { LimitOperator opCopy = new LimitOperator(exprDeepCopyVisitor.deepCopy(op.getMaxObjects().getValue()), exprDeepCopyVisitor.deepCopy(op.getOffset().getValue()), op.isTopmostLimitOp()); deepCopyInputsAnnotationsAndExecutionMode(op, arg, opCopy); return opCopy; }
LimitOperator limitCloneOp = null; if (limitOp.getOffset().getValue() == null) { limitCloneOp = new LimitOperator(limitOp.getMaxObjects().getValue(), false); limitCloneOp.setSourceLocation(sourceLoc); } else { ScalarFunctionCallExpression maxPlusOffset = new ScalarFunctionCallExpression(finfoAdd, addArgs); maxPlusOffset.setSourceLocation(sourceLoc); limitCloneOp = new LimitOperator(maxPlusOffset, false); limitCloneOp.setSourceLocation(sourceLoc);