public ILogicalExpression deepCopy(ILogicalExpression expr) throws AlgebricksException { if (expr == null) { return null; } return expr.accept(this, null); }
protected StringBuilder appendArguments(StringBuilder sb, List<Mutable<ILogicalExpression>> args, Integer indent) throws AlgebricksException { sb.append("[\n"); for (Mutable<ILogicalExpression> arg : args) { addIndent(sb, indent + 2).append(arg.getValue().accept(this, indent + 2)).append("\n"); } return addIndent(sb, indent).append("]"); }
protected StringBuilder appendArgument(StringBuilder sb, Mutable<ILogicalExpression> arg, Integer indent) throws AlgebricksException { sb.append("[\n"); addIndent(sb, indent + 2).append(arg.getValue().accept(this, indent + 2)).append("\n"); return addIndent(sb, indent).append("]"); }
private boolean visitFunctionExpression(AbstractFunctionCallExpression expr, Void arg) throws AlgebricksException { for (Mutable<ILogicalExpression> argRef : expr.getArguments()) { if (argRef.getValue().accept(this, arg)) { return true; } } return false; } }
private Void appendSelectConditionInformation(AlgebricksAppendable plan, Mutable<ILogicalExpression> condition, Integer indent) throws AlgebricksException { if (condition != null) { plan.append(",\n"); addIndent(indent).append( "\"condition\": \"" + condition.getValue().accept(exprVisitor, indent).replace('"', ' ') + "\""); } return null; }
@Override public Void visitLimitOperator(LimitOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("limit " + op.getMaxObjects().getValue().accept(exprVisitor, indent)); ILogicalExpression offset = op.getOffset().getValue(); if (offset != null) { buffer.append(", " + offset.accept(exprVisitor, indent)); } return null; }
@Override public Void visitSplitOperator(SplitOperator op, Integer indent) throws AlgebricksException { Mutable<ILogicalExpression> branchingExpression = op.getBranchingExpression(); addIndent(indent).append("split (" + branchingExpression.getValue().accept(exprVisitor, indent) + ")"); return null; }
@Override public Void visitSplitOperator(SplitOperator op, Integer indent) throws AlgebricksException { Mutable<ILogicalExpression> branchingExpression = op.getBranchingExpression(); addIndent(indent).append("\"operator\": \"split\",\n"); addIndent(indent).append("\"expressions\": \"" + branchingExpression.getValue().accept(exprVisitor, indent).replace('"', ' ') + "\""); return null; }
private boolean changeRec(AbstractFunctionCallExpression expr, Void arg) throws AlgebricksException { boolean changed = false; for (Mutable<ILogicalExpression> r : expr.getArguments()) { Pair<Boolean, ILogicalExpression> p2 = r.getValue().accept(this, arg); if (p2.first) { r.setValue(p2.second); changed = true; } } return changed; }
@Override public Void visitLimitOperator(LimitOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"limit\",\n"); addIndent(indent).append("\"value\": \"" + op.getMaxObjects().getValue().accept(exprVisitor, indent) + "\""); ILogicalExpression offset = op.getOffset().getValue(); if (offset != null) { buffer.append(",\n"); addIndent(indent).append("\"offset\": \"" + offset.accept(exprVisitor, indent) + "\""); } return null; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"left-outer-join\",\n"); addIndent(indent).append("\"condition\": \"" + op.getCondition().getValue().accept(exprVisitor, indent) + "\""); return null; }
@Override public Void visitInnerJoinOperator(InnerJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"join\",\n"); addIndent(indent).append("\"condition\": \"" + op.getCondition().getValue().accept(exprVisitor, indent) + "\""); return null; }
private Void appendSelectConditionInformation(AlgebricksAppendable plan, Mutable<ILogicalExpression> selectCondition, Integer indent) throws AlgebricksException { if (selectCondition != null) { plan.append(" condition (").append(selectCondition.getValue().accept(exprVisitor, indent)).append(")"); } return null; }
@Override public Void visitForwardOperator(ForwardOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"forward\""); addIndent(0).append(",\n"); addIndent(indent).append("\"expressions\": \"" + op.getRangeMapExpression().getValue().accept(exprVisitor, indent).replace('"', ' ') + "\""); return null; }
private AlgebricksAppendable printAbstractUnnestMapOperator(AbstractUnnestMapOperator op, Integer indent, String opSignature) throws AlgebricksException { AlgebricksAppendable plan = addIndent(indent).append(opSignature + " " + op.getVariables() + " <- " + op.getExpressionRef().getValue().accept(exprVisitor, indent)); appendFilterInformation(plan, op.getMinFilterVars(), op.getMaxFilterVars()); return plan; }
@Override public Void visitInnerJoinOperator(InnerJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("join (").append(op.getCondition().getValue().accept(exprVisitor, indent)).append(")"); return null; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("left outer join (").append(op.getCondition().getValue().accept(exprVisitor, indent)) .append(")"); return null; }
@Override public Void visitSelectOperator(SelectOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("select (").append(op.getCondition().getValue().accept(exprVisitor, indent)) .append(")"); return null; }
@Override public Void visitWriteResultOperator(WriteResultOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"load\",\n"); addIndent(indent).append(str(op.getDataSource())).append("\"from\":") .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent) + ",\n"); addIndent(indent).append("\"partitioned-by\": {"); pprintExprList(op.getKeyExpressions(), indent); addIndent(indent).append("}"); return null; }
@Override public Void visitWriteResultOperator(WriteResultOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("load ").append(str(op.getDataSource())).append(" from ") .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent)).append(" partitioned by "); pprintExprList(op.getKeyExpressions(), indent); return null; }