peter-toth opened a new pull request, #40488:
URL: https://github.com/apache/spark/pull/40488

   ### What changes were proposed in this pull request?
   This PR proposes to replace `EquivalentExpressions` to a simple mutable map 
in `PhysicalAggregation`, the only place where 
`EquivalentExpressions.addExpr()` is used. `EquivalentExpressions` is useful 
for common subexpression elimination but in `PhysicalAggregation` it is used 
only to deduplicate whole expressions which can be easily done with a simple 
map.
   
   ### Why are the changes needed?
   `EquivalentExpressions.addExpr()` is not guarded by `supportedExpression()` 
which can cause inconsistent results when used together with 
`EquivalentExpressions.getExprState()`, but this PR also proposes replacing 
`.addExpr()` with other alternatives as its boolean result is a bit 
counter-intuitive to other collections' `.add()` methods. It returns `false` if 
the expression was missing and either adds the expression or not depending on 
if the expression is deterministic.
   After this PR we no longer use `EquivalentExpressions.addExpr()` so it can 
be deprecated or even removed...
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Added new UTs from @rednaxelafx's PR: 
https://github.com/apache/spark/pull/40473. Please note that new UTs actually 
pass after https://github.com/apache/spark/pull/40475, but they are added here 
to make sure there will be no regression in the future.
   


-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to