maropu commented on a change in pull request #25717: [WIP][SPARK-29013][SQL] Structurally equivalent subexpression elimination URL: https://github.com/apache/spark/pull/25717#discussion_r321996734
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala ########## @@ -40,23 +40,47 @@ class EquivalentExpressions { override def hashCode: Int = e.semanticHash() } + /** + * Wrapper around an Expression that provides structural semantic equality. + */ + case class StructuralExpr(e: Expression) { + def normalized(expr: Expression): Expression = { + expr.transformUp { + case b: ParameterizedBoundReference => Review comment: To avoid unnecessary plan copys, we can check this equality based on `BoundReference` (by just copying it like `b.copy(ordinal = 0 or -1?)`)? IIUC its ok to replace `BoundReference` with `ParameterizedBoundReference` just when generating code in https://github.com/apache/spark/pull/25717/files#diff-8bcc5aea39c73d4bf38aef6f6951d42cR1117? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org