private Logic end(RexNode node, Logic arg) { if (node.equals(seek)) { logicCollection.add(arg); } return arg; }
@Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableFilter && condition.equals(((MutableFilter) obj).condition) && input.equals(((MutableFilter) obj).input); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RexFieldAccess that = (RexFieldAccess) o; return field.equals(that.field) && expr.equals(that.expr); }
@Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableJoin && joinType == ((MutableJoin) obj).joinType && condition.equals(((MutableJoin) obj).condition) && Objects.equals(variablesSet, ((MutableJoin) obj).variablesSet) && left.equals(((MutableJoin) obj).left) && right.equals(((MutableJoin) obj).right); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RexWindowBoundBounded that = (RexWindowBoundBounded) o; if (!offset.equals(that.offset)) { return false; } if (sqlKind != that.sqlKind) { return false; } return true; }
/** Removes all expressions from a list that are equivalent to a given * expression. Returns whether any were removed. */ public static boolean removeAll(List<RexNode> targets, RexNode e) { int count = 0; Iterator<RexNode> iterator = targets.iterator(); while (iterator.hasNext()) { RexNode next = iterator.next(); if (next.equals(e)) { ++count; iterator.remove(); } } return count > 0; }
@Override public boolean isNull(RexNode node) { return node.equals(operand) || super.isNull(node); } };
@Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableSemiJoin && condition.equals(((MutableSemiJoin) obj).condition) && leftKeys.equals(((MutableSemiJoin) obj).leftKeys) && rightKeys.equals(((MutableSemiJoin) obj).rightKeys) && left.equals(((MutableSemiJoin) obj).left) && right.equals(((MutableSemiJoin) obj).right); }
private int lookupOrCreateGroupExpr(RexNode expr) { int index = 0; for (RexNode convertedInputExpr : Pair.left(convertedInputExprs)) { if (expr.equals(convertedInputExpr)) { return index; } ++index; } // not found -- add it addExpr(expr, null); return index; }
private RexNode simplifyIsPredicate(SqlKind kind, RexNode a) { if (!RexUtil.isReferenceOrAccess(a, true)) { return null; } for (RexNode p : predicates.pulledUpPredicates) { IsPredicate pred = IsPredicate.of(p); if (pred == null || !a.equals(pred.ref)) { continue; } if (kind == pred.kind) { return rexBuilder.makeLiteral(true); } } return null; }
public RexNode simplifyPreservingType(RexNode e, RexUnknownAs unknownAs, boolean matchNullability) { final RexNode e2 = simplifyUnknownAs(e, unknownAs); if (e2.getType() == e.getType()) { return e2; } final RexNode e3 = rexBuilder.makeCast(e.getType(), e2, matchNullability); if (e3.equals(e)) { return e; } return e3; }
if (first.equals(second)) { return true;
@Override public void onMatch(RelOptRuleCall call) { Join join = call.rel(0); // Push expression in join condition into Project below Join. RelNode newJoin = RelOptUtil.pushDownJoinConditions(join, call.builder()); // If the join is the same, we bail out if (newJoin instanceof Join) { final RexNode newCondition = ((Join) newJoin).getCondition(); if (join.getCondition().equals(newCondition)) { return; } } call.transformTo(newJoin); } }
case GREATER_THAN_OR_EQUAL: final RexCall call = (RexCall) predicate; if (call.operands.get(0).equals(ref) && call.operands.get(1) instanceof RexLiteral) { final RexLiteral literal = (RexLiteral) call.operands.get(1);
simplify.simplifyPreservingType(expList.get(i), unknownAs, matchNullability); if (!expr2.equals(expList.get(i))) { expList.set(i, expr2); simplified = true;
if (o0.equals(o1) && (unknownAs == FALSE || (!o0.getType().isNullable()
if (lastBranch.value.equals(newValue) && isSafeExpression(newCond)) {
&& ((ByteString) literal.getValue()).length() > toType.getPrecision()); boolean couldSimplify = !cast.equals(simplified); final String reason = (expectedSimplify ? "expected to simplify, but could not: "
@Override public void onMatch(RelOptRuleCall call) { final Filter filter = call.rel(0); final RexBuilder rexBuilder = filter.getCluster().getRexBuilder(); final String timeZone = filter.getCluster().getPlanner().getContext() .unwrap(CalciteConnectionConfig.class).timeZone(); final RexNode condition = replaceTimeUnits(rexBuilder, filter.getCondition(), timeZone); if (condition.equals(filter.getCondition())) { return; } final RelBuilder relBuilder = relBuilderFactory.create(filter.getCluster(), null); relBuilder.push(filter.getInput()) .filter(condition); call.transformTo(relBuilder.build()); } }