/** * 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); }
public RexCall clone() { return new RexCall(type, op, operands); }
/** * 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 an array 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.newOperator, 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.castFunc, 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)); }
/** * Creates a call with an array of arguments. * * <p>If you already know the return type of the call, then * {@link #makeCall(org.eigenbase.reltype.RelDataType, org.eigenbase.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); }
/** * Creates a call with an array of arguments. * * <p>This is the fundamental method called by all of the other <code> * makeCall</code> methods. If you derive a class from {@link RexBuilder}, * this is the only method you need to override.</p> */ public RexNode makeCall( SqlOperator op, List<? extends RexNode> exprs) { // TODO jvs 12-Jun-2010: Find a better place for this; // it surely does not belong here. if (op == SqlStdOperatorTable.andOperator && exprs.size() == 2 && exprs.get(0).equals(exprs.get(1))) { // Avoid generating 'AND(x, x)'; this can cause plan explosions if a // relnode is its own child and is merged with itself. return exprs.get(0); } final RelDataType type = deriveReturnType(op, typeFactory, 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.reinterpretOperator, args); }
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; } }
/** * Makes an expression which converts a value of type T to a value of type T * NOT NULL, or throws if the value is NULL. If the expression is already * NOT NULL, does nothing. */ public RexNode makeNotNullCast(RexNode expr) { RelDataType type = expr.getType(); if (!type.isNullable()) { return expr; } RelDataType typeNotNull = getTypeFactory().createTypeWithNullability(type, false); return new RexCall( typeNotNull, SqlStdOperatorTable.CAST, ImmutableList.of(expr)); }
/** * Makes an expression which converts a value of type T to a value of type T * NOT NULL, or throws if the value is NULL. If the expression is already * NOT NULL, does nothing. */ public RexNode makeNotNullCast(RexNode expr) { RelDataType type = expr.getType(); if (!type.isNullable()) { return expr; } RelDataType typeNotNull = getTypeFactory().createTypeWithNullability(type, false); return new RexCall( typeNotNull, SqlStdOperatorTable.castFunc, ImmutableList.of(expr)); }
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; } }