/** * Creates a call with a list of arguments and a predetermined type. */ public RexNode makeCall( RelDataType returnType, SqlOperator op, List<RexNode> exprs) { return new RexCall(returnType, op, exprs); }
/** * Creates a new call to the same operator with different operands. * * @param type Return type * @param operands Operands to call * @return New call */ public RexCall clone(RelDataType type, List<RexNode> operands) { return new RexCall(type, op, operands); } }
/** * Creates a call with a list of arguments and a predetermined type. */ public RexNode makeCall( RelDataType returnType, SqlOperator op, List<RexNode> exprs) { return new RexCall(returnType, op, exprs); }
/** * Creates a new call to the same operator with different operands. * * @param type Return type * @param operands Operands to call * @return New call */ public RexCall clone(RelDataType type, List<RexNode> operands) { return new RexCall(type, op, operands); }
/** * Creates an invocation of the NEW operator. * * @param type Type to be instantiated * @param exprs Arguments to NEW operator * @return Expression invoking NEW operator */ public RexNode makeNewInvocation( RelDataType type, List<RexNode> exprs) { return new RexCall( type, SqlStdOperatorTable.NEW, exprs); }
/** * Creates an invocation of the NEW operator. * * @param type Type to be instantiated * @param exprs Arguments to NEW operator * @return Expression invoking NEW operator */ public RexNode makeNewInvocation( RelDataType type, List<RexNode> exprs) { return new RexCall( type, SqlStdOperatorTable.NEW, exprs); }
/** * Creates a call to the CAST operator. * * @param type Type to cast to * @param exp Expression being cast * @return Call to CAST operator */ public RexNode makeAbstractCast( RelDataType type, RexNode exp) { return new RexCall( type, SqlStdOperatorTable.CAST, ImmutableList.of(exp)); }
/** * Creates a call to the CAST operator. * * @param type Type to cast to * @param exp Expression being cast * @return Call to CAST operator */ public RexNode makeAbstractCast( RelDataType type, RexNode exp) { return new RexCall( type, SqlStdOperatorTable.CAST, ImmutableList.of(exp)); }
private static RexNode addNot(RexNode e) { return new RexCall(e.getType(), SqlStdOperatorTable.NOT, ImmutableList.of(e)); }
/** * Creates a call with an array of arguments. * * <p>If you already know the return type of the call, then * {@link #makeCall(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.sql.SqlOperator, java.util.List)} * is preferred.</p> */ public RexNode makeCall( SqlOperator op, List<? extends RexNode> exprs) { final RelDataType type = deriveReturnType(op, exprs); return new RexCall(type, op, exprs); }
private static RexNode addNot(RexNode e) { return new RexCall(e.getType(), SqlStdOperatorTable.NOT, ImmutableList.of(e)); }
/** * Creates a call with an array of arguments. * * <p>If you already know the return type of the call, then * {@link #makeCall(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.sql.SqlOperator, java.util.List)} * is preferred.</p> */ public RexNode makeCall( SqlOperator op, List<? extends RexNode> exprs) { final RelDataType type = deriveReturnType(op, exprs); return new RexCall(type, op, exprs); }
/** * Makes a reinterpret cast. * * @param type type returned by the cast * @param exp expression to be casted * @param checkOverflow whether an overflow check is required * @return a RexCall with two operands and a special return type */ public RexNode makeReinterpretCast( RelDataType type, RexNode exp, RexNode checkOverflow) { List<RexNode> args; if ((checkOverflow != null) && checkOverflow.isAlwaysTrue()) { args = ImmutableList.of(exp, checkOverflow); } else { args = ImmutableList.of(exp); } return new RexCall( type, SqlStdOperatorTable.REINTERPRET, args); }
/** * Makes a reinterpret cast. * * @param type type returned by the cast * @param exp expression to be casted * @param checkOverflow whether an overflow check is required * @return a RexCall with two operands and a special return type */ public RexNode makeReinterpretCast( RelDataType type, RexNode exp, RexNode checkOverflow) { List<RexNode> args; if ((checkOverflow != null) && checkOverflow.isAlwaysTrue()) { args = ImmutableList.of(exp, checkOverflow); } else { args = ImmutableList.of(exp); } return new RexCall( type, SqlStdOperatorTable.REINTERPRET, args); }
@Override public RexNode visitCall(final RexCall call, P arg) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(call.operands, update, arg); if (update[0]) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return new RexCall( call.getType(), call.getOperator(), clonedOperands); } else { return call; } }
public RexNode visitCall(final RexCall call) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(call.operands, update); if (update[0]) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return new RexCall( call.getType(), call.getOperator(), clonedOperands); } else { return call; } }