/** * 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; }
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);
List<RexNode> exprs = call.getOperands();
RexNode child = ((RexCall) literalExpr).getOperands().get(0); assert RexLiteral.isNullLiteral(child);
public Boolean visitCall(RexCall call) { for (RexNode operand : call.getOperands()) { Boolean valid = operand.accept(this); if (valid != null && !valid) { return false; } } return true; }
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 Boolean visitCall(RexCall call) { for (RexNode operand : call.getOperands()) { Boolean valid = operand.accept(this); if (valid != null && !valid) { return false; } } return true; }
private static void flattenRecurse( List<RexNode> list, List<? extends RexNode> exprs, SqlOperator op) { for (RexNode expr : exprs) { if (expr instanceof RexCall && ((RexCall) expr).getOperator() == op) { flattenRecurse(list, ((RexCall) expr).getOperands(), op); } else { list.add(expr); } } }
private static RelDataType parseCast(RexNode rex) { if (rex instanceof RexCall) { final RexCall call = (RexCall) rex; if (call.getOperator() == SqlStdOperatorTable.castFunc) { assert call.getOperands().size() == 1; return call.getType(); } } return null; }
public RexNode visitCall(RexCall call) { final List<RexNode> newOperands = new ArrayList<RexNode>(); for (RexNode operand : call.getOperands()) { newOperands.add(operand.accept(this)); } return call.clone(call.getType(), newOperands); }
public RexNode visitCall(RexCall call) { final List<RexNode> newOperands = new ArrayList<RexNode>(); for (RexNode operand : call.getOperands()) { newOperands.add(operand.accept(this)); } return call.clone(call.getType(), newOperands); }
private boolean isAlwaysTrue(RexNode predicate) { if (predicate instanceof RexCall) { RexCall c = (RexCall) predicate; if (c.getOperator().getKind() == SqlKind.EQUALS) { int lPos = pos(c.getOperands().get(0)); int rPos = pos(c.getOperands().get(1)); return lPos != -1 && lPos == rPos; } } return predicate.isAlwaysTrue(); } }
public Expression implement( RexToLixTranslator translator, RexCall call, NullAs nullAs) { final MethodImplementor implementor = getImplementor( call.getOperands().get(0).getType().getSqlTypeName()); return implementNullSemantics0( translator, call, nullAs, NullPolicy.STRICT, false, implementor); }
@Override public Void visitCall(RexCall call) { if (call.getOperator() == RexBuilder.GET_OPERATOR) { RexLiteral literal = (RexLiteral) call.getOperands().get(1); extraFields.add( new RelDataTypeFieldImpl( (String) literal.getValue2(), -1, call.getType())); } return super.visitCall(call); } }
public Boolean visitCall(RexCall call) { // Constant if operator is deterministic and all operands are // constant. return call.getOperator().isDeterministic() && RexVisitorImpl.visitArrayAnd(this, call.getOperands()); }
public Expression implement( RexToLixTranslator translator, RexCall call, NullAs nullAs) { return translator.translateConstructor( call.getOperands(), call.getOperator().getKind()); } }
@Override public RexNode visitCall(RexCall call) { if (call.getOperator() == RexBuilder.GET_OPERATOR) { final String name = (String) ((RexLiteral) call.getOperands().get(1)).getValue2(); final int i = lookup(fields, name); if (i >= 0) { return RexInputRef.of(i, fields); } } return super.visitCall(call); }
@Override public RexNode visitCall(RexCall call) { if (call.getOperator() == RexBuilder.GET_OPERATOR) { final String name = (String) ((RexLiteral) call.getOperands().get(1)).getValue2(); final int i = lookup(fields, name); if (i >= 0) { return RexInputRef.of(i, fields); } } return super.visitCall(call); }
public RexNode visitCall(final RexCall call) { return builder.makeCall( builder.getTypeFactory().copyType(call.getType()), call.getOperator(), visitList(call.getOperands(), null)); }
public RexNode visitCall(final RexCall call) { final boolean[] update = null; return builder.makeCall( builder.getTypeFactory().copyType(call.getType()), call.getOperator(), visitList(call.getOperands(), update)); }