/** * Accepts a {@link SqlVisitor}, directing an * {@link org.apache.calcite.sql.util.SqlBasicVisitor.ArgHandler} * to visit an operand of a call. * * <p>The argument handler allows fine control about how the operands are * visited, and how the results are combined. * * @param visitor Visitor * @param call Call to visit * @param onlyExpressions If true, ignores operands which are not * expressions. For example, in the call to the * <code>AS</code> operator * @param argHandler Called for each operand */ public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { argHandler.visitChild(visitor, call, i, operands.get(i)); } }
@Override public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { SqlNode operand = operands.get(i); if (operand == null) { continue; } argHandler.visitChild(visitor, call, i, operand); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
/** * Accepts a {@link SqlVisitor}, directing an * {@link org.apache.calcite.sql.util.SqlBasicVisitor.ArgHandler} * to visit an operand of a call. * * <p>The argument handler allows fine control about how the operands are * visited, and how the results are combined. * * @param visitor Visitor * @param call Call to visit * @param onlyExpressions If true, ignores operands which are not * expressions. For example, in the call to the * <code>AS</code> operator * @param argHandler Called for each operand */ public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { argHandler.visitChild(visitor, call, i, operands.get(i)); } }
/** * Accepts a {@link SqlVisitor}, and tells it to visit each child. * * @param visitor Visitor */ public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { for (Ord<SqlNode> operand : Ord.zip(call.getOperandList())) { // if the second param is an Identifier then it's supposed to // be a name from a window clause and isn't part of the // group by check if (operand == null) { continue; } if (operand.i == 1 && operand.e instanceof SqlIdentifier) { continue; } argHandler.visitChild(visitor, call, operand.i, operand.e); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } } }
/** * Accepts a {@link SqlVisitor}, and tells it to visit each child. * * @param visitor Visitor */ public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { for (Ord<SqlNode> operand : Ord.zip(call.getOperandList())) { // if the second param is an Identifier then it's supposed to // be a name from a window clause and isn't part of the // group by check if (operand == null) { continue; } if (operand.i == 1 && operand.e instanceof SqlIdentifier) { continue; } argHandler.visitChild(visitor, call, operand.i, operand.e); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } } }
public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { for (Ord<SqlNode> operand : Ord.zip(call.getOperandList())) { // if the second param is an Identifier then it's supposed to // be a name from a window clause and isn't part of the // group by check if (operand.e == null) { continue; } if (operand.i == 1 && operand.e instanceof SqlIdentifier) { // skip refName continue; } argHandler.visitChild(visitor, call, operand.i, operand.e); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { for (Ord<SqlNode> operand : Ord.zip(call.getOperandList())) { // if the second param is an Identifier then it's supposed to // be a name from a window clause and isn't part of the // group by check if (operand.e == null) { continue; } if (operand.i == 1 && operand.e instanceof SqlIdentifier) { // skip refName continue; } argHandler.visitChild(visitor, call, operand.i, operand.e); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
@Override public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { SqlNode operand = operands.get(i); if (operand == null) { continue; } argHandler.visitChild(visitor, call, i, operand); } } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { // Do not visit operands[1] -- it is not an expression. argHandler.visitChild(visitor, call, 0, call.operand(0)); } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
@Override public <R> void acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { // Do not visit operands[1] -- it is not an expression. argHandler.visitChild(visitor, call, 0, call.operand(0)); } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
@Override public <R> void acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { // Do not visit operands[1] -- it is not an expression. argHandler.visitChild(visitor, call, 0, call.operand(0)); } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }
public <R> void acceptCall( SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler) { if (onlyExpressions) { // Do not visit operands[1] -- it is not an expression. argHandler.visitChild(visitor, call, 0, call.operand(0)); } else { super.acceptCall(visitor, call, onlyExpressions, argHandler); } }