Skip to content

Commit

Permalink
Force expression children to be canonicalized before being canonicali…
Browse files Browse the repository at this point in the history
…zed itself.
  • Loading branch information
viirya committed Mar 11, 2016
1 parent 9525c56 commit c6e8415
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ abstract class Expression extends TreeNode[Expression] {
* `deterministic` expressions where `this.canonicalized == other.canonicalized` will always
* evaluate to the same result.
*/
lazy val canonicalized: Expression = Canonicalize.execute(this)
lazy val canonicalized: Expression = {
val canonicalizedChildred = children.map(_.canonicalized)
Canonicalize.execute(withNewChildren(canonicalizedChildred))
}

/**
* Returns true when two expressions will always compute the same result, even if they differ
Expand All @@ -161,7 +164,7 @@ abstract class Expression extends TreeNode[Expression] {
* See [[Canonicalize]] for more details.
*/
def semanticEquals(other: Expression): Boolean =
deterministic && other.deterministic && canonicalized == other.canonicalized
deterministic && other.deterministic && canonicalized == other.canonicalized

/**
* Returns a `hashCode` for the calculation performed by this expression. Unlike the standard
Expand Down

0 comments on commit c6e8415

Please sign in to comment.