MCPcopy Create free account
hub / github.com/apache/impala / matches

Method matches

fe/src/main/java/org/apache/impala/analysis/Expr.java:1011–1028  ·  view source on GitHub ↗

Returns true if this expr matches 'that'. Two exprs match if: 1. The tree structures ignoring implicit casts are the same. 2. For every pair of corresponding SlotRefs, slotRefCmp.matches() returns true. 3. For every pair of corresponding non-SlotRef exprs, localEquals() returns true.

(Expr that, SlotRef.Comparator slotRefCmp)

Source from the content-addressed store, hash-verified

1009 * 3. For every pair of corresponding non-SlotRef exprs, localEquals() returns true.
1010 */
1011 public boolean matches(Expr that, SlotRef.Comparator slotRefCmp) {
1012 if (that == null) return false;
1013 if (this instanceof CastExpr && ((CastExpr)this).isImplicit()) {
1014 return children_.get(0).matches(that, slotRefCmp);
1015 }
1016 if (that instanceof CastExpr && ((CastExpr)that).isImplicit()) {
1017 return matches(((CastExpr) that).children_.get(0), slotRefCmp);
1018 }
1019 if (this instanceof SlotRef && that instanceof SlotRef) {
1020 return slotRefCmp.matches((SlotRef)this, (SlotRef)that);
1021 }
1022 if (!localEquals(that)) return false;
1023 if (children_.size() != that.children_.size()) return false;
1024 for (int i = 0; i < children_.size(); ++i) {
1025 if (!children_.get(i).matches(that.children_.get(i), slotRefCmp)) return false;
1026 }
1027 return true;
1028 }
1029
1030 /**
1031 * Local eq comparator. Returns true if this expr is equal to 'that' ignoring children.

Callers 1

equalsMethod · 0.95

Calls 5

localEqualsMethod · 0.95
isImplicitMethod · 0.80
matchesMethod · 0.65
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected