private BinaryTupleExpression getBinaryTupleExpression(RexCall call, TupleExpression.ExpressionOperatorEnum op) { assert call.operands.size() == 2; TupleExpression left = call.operands.get(0).accept(this); TupleExpression right = call.operands.get(1).accept(this); BinaryTupleExpression tuple = new BinaryTupleExpression(op, Lists.newArrayList(left, right)); tuple.setDigest(call.toString()); return tuple; }
@Override public Void visitCall(RexCall call) { if (call.getOperator().getKind() == SqlKind.EQUALS) { int lPos = pos(call.getOperands().get(0)); int rPos = pos(call.getOperands().get(1)); if (lPos != -1 && rPos != -1) { JoinConditionBasedPredicateInference.this.equivalent(lPos, rPos); JoinConditionBasedPredicateInference.this.equalityPredicates .add(call.toString()); } } return null; } }
private RexCallTupleExpression getRexCallTupleExpression(RexCall call) { List<TupleExpression> children = Lists.newArrayListWithExpectedSize(call.getOperands().size()); for (RexNode rexNode : call.operands) { children.add(rexNode.accept(this)); } RexCallTupleExpression tuple = new RexCallTupleExpression(children); tuple.setDigest(call.toString()); return tuple; }
@Override public Void visitCall(RexCall call) { if (call.getOperator().getKind() == SqlKind.EQUALS) { int lPos = pos(call.getOperands().get(0)); int rPos = pos(call.getOperands().get(1)); if (lPos != -1 && rPos != -1) { JoinConditionBasedPredicateInference.this.equivalent(lPos, rPos); JoinConditionBasedPredicateInference.this.equalityPredicates .add(call.toString()); } } return null; } }
@Override public RexNode visitCall(RexCall call) { final Integer integer = map.get(call.toString()); if (integer != null) { return new RexInputRef(integer, call.getType()); } return super.visitCall(call); } };
tuple.setDigest(call.toString()); return tuple;
@Override public int hashCode() { return toString().hashCode(); } }
@Override public boolean equals(Object obj) { return obj == this || obj instanceof RexCall && toString().equals(obj.toString()); }
@Override public RexNode visitCall(RexCall call) { final Integer integer = map.get(call.toString()); if (integer != null) { return new RexInputRef(integer, call.getType()); } return super.visitCall(call); } };
private BinaryTupleExpression getBinaryTupleExpression(RexCall call, TupleExpression.ExpressionOperatorEnum op) { assert call.operands.size() == 2; TupleExpression left = call.operands.get(0).accept(this); TupleExpression right = call.operands.get(1).accept(this); BinaryTupleExpression tuple = new BinaryTupleExpression(op, Lists.newArrayList(left, right)); tuple.setDigest(call.toString()); return tuple; }
private RexCallTupleExpression getRexCallTupleExpression(RexCall call) { List<TupleExpression> children = Lists.newArrayListWithExpectedSize(call.getOperands().size()); for (RexNode rexNode : call.operands) { children.add(rexNode.accept(this)); } RexCallTupleExpression tuple = new RexCallTupleExpression(children); tuple.setDigest(call.toString()); return tuple; }
@Override public Void visitCall(RexCall call) { if (call.getOperator().getKind() == SqlKind.EQUALS) { int lPos = pos(call.getOperands().get(0)); int rPos = pos(call.getOperands().get(1)); if (lPos != -1 && rPos != -1) { JoinConditionBasedPredicateInference.this.equivalent(lPos, rPos); JoinConditionBasedPredicateInference.this.equalityPredicates .add(call.toString()); } } return null; } }
@Override public String visitCall(RexCall call) { final String name = isItem(call); if (name != null) { return "\"" + name + "\""; } final List<String> strings = visitList(call.operands); if (call.getKind() == SqlKind.CAST) { return strings.get(0).startsWith("$") ? strings.get(0).substring(1) : strings.get(0); } if (call.getOperator() == SqlStdOperatorTable.ITEM) { final RexNode op1 = call.getOperands().get(1); if (op1 instanceof RexLiteral && op1.getType().getSqlTypeName() == SqlTypeName.INTEGER) { return stripQuotes(strings.get(0)) + "[" + ((RexLiteral) op1).getValue2() + "]"; } } throw new IllegalArgumentException("Translation of " + call.toString() + " is not supported by ElasticsearchProject"); }
@Override public RexNode visitCall(final RexCall call) { Collection<Integer> c = exprsLineage.get(call.toString()); if (c.isEmpty()) { // Cannot map expression return super.visitCall(call); } int pos = c.iterator().next(); if (rewritingMapping != null) { pos = rewritingMapping.getTargetOpt(pos); if (pos == -1) { // Cannot map expression return super.visitCall(call); } } if (node != null) { return rexBuilder.makeInputRef(node, pos); } return rexBuilder.makeInputRef(call.getType(), pos); } };
tuple.setDigest(call.toString()); return tuple;
f.rexBuilder.makeFlag(timeUnitRanges.get(j))); final RexCall floorSimplifiedExpr = (RexCall) defaultSimplifier.apply(outerFloorCall); assertThat(floorSimplifiedExpr.toString(), is(outerFloorCall.toString())); final RexCall ceilSimplifiedExpr = (RexCall) defaultSimplifier.apply(outerCeilCall); assertThat(ceilSimplifiedExpr.toString(), is(outerCeilCall.toString()));
(RexCall) f.simplify.simplifyPreservingType(outerFloorCall, RexUnknownAs.UNKNOWN, true); assertThat(floorSimplifiedExpr.toString(), is(outerFloorCall.toString())); final RexCall ceilSimplifiedExpr = (RexCall) f.simplify.simplifyPreservingType(outerCeilCall, RexUnknownAs.UNKNOWN, true); assertThat(ceilSimplifiedExpr.toString(), is(outerCeilCall.toString()));