minyyy commented on code in PR #36121:
URL: https://github.com/apache/spark/pull/36121#discussion_r846370133
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ExpressionSet.scala:
##########
@@ -74,49 +83,37 @@ class ExpressionSet protected(
protected def remove(e: Expression): Unit = {
if (e.deterministic) {
- baseSet --= baseSet.filter(_ == e.canonicalized)
- originals --= originals.filter(_.canonicalized == e.canonicalized)
+ baseSet.retain(_ != e.canonicalized)
+ originals = originals.filter(!_.semanticEquals(e))
}
}
- def contains(elem: Expression): Boolean =
baseSet.contains(elem.canonicalized)
+ override def contains(elem: Expression): Boolean =
baseSet.contains(elem.canonicalized)
override def filter(p: Expression => Boolean): ExpressionSet = {
- val newBaseSet = baseSet.filter(e => p(e.canonicalized))
+ val newBaseSet = baseSet.filter(e => p(e))
Review Comment:
By invariant 1: `.canonicalized` is not needed and can cause performance
issue.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]