@@ -83,31 +83,14 @@ trait ConstraintHelper {
8383 inferredConstraints -- constraints
8484 }
8585
86- private def replaceConstraint (
87- constraint : Expression ,
88- source : Expression ,
89- destination : Expression ): Expression = constraint transform {
90- case e : Expression if e.semanticEquals(source) => destination
91- }
92-
9386 private def replaceConstraints (
9487 constraints : Set [Expression ],
9588 source : Expression ,
96- dest : Expression ): Set [Expression ] = {
97- constraints.map {
98- case b @ BinaryComparison (left, right) =>
99- (replaceConstraint(left, source, dest), replaceConstraint(right, source, dest)) match {
100- case (Cast (Cast (child, _, _), dt, _), replacedRight)
101- if dt == child.dataType && child.dataType == replacedRight.dataType =>
102- b.makeCopy(Array (child, replacedRight))
103- case (replacedLeft, Cast (Cast (child, _, _), dt, _))
104- if dt == child.dataType && child.dataType == replacedLeft.dataType =>
105- b.makeCopy(Array (replacedLeft, child))
106- case (replacedLeft, replacedRight) =>
107- b.makeCopy(Array (replacedLeft, replacedRight))
108- }
109- }
110- }
89+ destination : Expression ): Set [Expression ] = constraints.map(_ transform {
90+ case e : Expression if e.semanticEquals(source) => destination
91+ }).map(_ transform {
92+ case Cast (e @ Cast (child, _, _), dt, _) if e == destination && dt == child.dataType => child
93+ })
11194
11295 /**
11396 * Infers a set of `isNotNull` constraints from null intolerant expressions as well as
0 commit comments