RexCall call = (RexCall) node; List<RexNode> list = new ArrayList<RexNode>(); List<RexNode> operands = Lists.newArrayList(call.getOperands()); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i); list.add(e); if (!list.equals(call.getOperands())) { return call.clone(call.getType(), list);
public RexNode visitCall(RexCall call) { final SqlOperator op = call.getOperator(); if (!(op instanceof SqlAggFunction)) { return super.visitCall(call); final RelDataType type = call.getType(); List<RexNode> exprs = call.getOperands();
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; } }
/** * Determines whether a RexNode corresponds to a subquery that's been * converted to a constant. * * @param rex the expression to be examined * @return true if the expression is a dynamic parameter, a literal, or * a literal that is being cast */ private boolean isConvertedSubq(RexNode rex) { if ((rex instanceof RexLiteral) || (rex instanceof RexDynamicParam)) { return true; } if (rex instanceof RexCall) { RexCall call = (RexCall) rex; if (call.getOperator() == SqlStdOperatorTable.CAST) { RexNode operand = call.getOperands().get(0); if (operand instanceof RexLiteral) { return true; } } } return false; }
/** * Returns true if call is call to <code>CAST</code> and the to/from cast * types are of multiset types */ public static boolean isMultisetCast(RexCall call) { if (!call.getOperator().equals(SqlStdOperatorTable.castFunc)) { return false; } return call.getType().getSqlTypeName() == SqlTypeName.MULTISET; }
public RexNode visitCall(RexCall rexCall) { if (rexCall.isA(RexKind.Cast)) { RexNode input = rexCall.getOperands().get(0).accept(this); RelDataType targetType = removeDistinct(rexCall.getType()); return rexBuilder.makeCast( targetType, input); } if (!rexCall.isA(RexKind.Comparison)) { return super.visitCall(rexCall); } RexNode lhs = rexCall.getOperands().get(0); if (!lhs.getType().isStruct()) { // NOTE jvs 9-Mar-2005: Calls like IS NULL operate // on the representative null indicator. Since it comes // first, we don't have to do any special translation. return super.visitCall(rexCall); } // NOTE jvs 22-Mar-2005: Likewise, the null indicator takes // care of comparison null semantics without any special casing. return flattenComparison( rexBuilder, rexCall.getOperator(), rexCall.getOperands()); }
if (transformableOperators.contains(call.getOperator())) { assert 2 == operands.size(); SqlStdOperatorTable.AND, intoFinalAnd, call.clone(call.getType(), operands)); return andNullAndCheckNode; return call.clone(call.getType(), operands);
SqlOperator op = rexCall.getOperator(); boolean alwaysTrue; switch (rexCall.getKind()) { case IS_NULL: case IS_UNKNOWN: alwaysTrue = !alwaysTrue; RexNode operand = rexCall.getOperands().get(0); if (operand instanceof RexInputRef) { RexInputRef inputRef = (RexInputRef) operand;
switch (call.getKind()) { case Reinterpret: case IsNull: break; case Cast: RelDataType lhsType = call.getType(); RelDataType rhsType = call.operands.get(0).getType(); if (rhsType.getSqlTypeName() == SqlTypeName.NULL) { localCheck = call.getOperator().requiresDecimalExpansion(); if (SqlTypeUtil.isDecimal(call.getType())) {
public Expression implement(RexToLixTranslator translator, RexCall call, NullAs nullAs) { // Short-circuit if no cast is required RexNode arg = call.getOperands().get(0); if (call.getType().equals(arg.getType())) { // No cast required, omit cast return translator.translate(arg, nullAs); } return accurate.implement(translator, call, nullAs); } }
private boolean isConstructor(RexNode rexNode) { // TODO jvs 11-Feb-2005: share code with SqlToRelConverter if (!(rexNode instanceof RexCall)) { return false; } RexCall call = (RexCall) rexNode; return call.getOperator().getName().equalsIgnoreCase("row") || (call.isA(RexKind.NewSpecification)); }
@Override public Void visitCall(RexCall call) { if (call.getOperator() == RexBuilder.GET_OPERATOR) { throw Util.FoundOne.NULL; } return super.visitCall(call); } });
/** * 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 Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> translatedOperands) { assert call.getOperands().size() == 1; return translatedOperands.get(0); } }
if (call.isA(RexKind.MinusPrefix)) { distinctRowCount = cardOfProjExpr(rel, call.getOperands().get(0)); } else if (call.isA(RexKind.Plus) || call.isA(RexKind.Minus)) { Double card0 = cardOfProjExpr(rel, call.getOperands().get(0)); if (card0 == null) { return null; Double card1 = cardOfProjExpr(rel, call.getOperands().get(1)); if (card1 == null) { return null; } else if (call.isA(RexKind.Times) || call.isA(RexKind.Divide)) { distinctRowCount = NumberUtil.multiply( cardOfProjExpr(rel, call.getOperands().get(0)), cardOfProjExpr(rel, call.getOperands().get(1))); if (call.getOperands().size() == 1) { distinctRowCount = cardOfProjExpr( rel, call.getOperands().get(0)); } else { distinctRowCount = rowCount / 10;
public RexWindowBoundBounded(RexNode node) { assert node instanceof RexCall : "RexWindowBoundBounded window bound should be either 'X preceding'" + " or 'X following' call. Actual type is " + node; RexCall call = (RexCall) node; this.offset = call.getOperands().get(0); this.sqlKind = call.getKind(); assert this.offset != null : "RexWindowBoundBounded offset should not be" + " null"; }
public String toString() { // REVIEW jvs 16-Jan-2005: For CAST and NEW, the type is really an // operand and needs to be printed out. But special-casing it here is // ugly. return computeDigest( isA(SqlKind.CAST) || isA(SqlKind.NEW_SPECIFICATION)); }