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

   ### What changes were proposed in this pull request?
   This PR improves `ConstantPropagation` rule, the new implementation:
   - Collects constants into a map directly, instead of a list that is then 
transformed into a map.
   - Supports substituting in conflicting equalities:
     e.g. `a = 1 AND a = 2` => `a = 1 AND 1 = 2`
     Before this PR this unsatisfiable filter was not reduced:
     ```
     == Physical Plan ==
     *(1) Project [value#219 AS a#222]
     +- *(1) Filter ((isnotnull(value#219) AND (value#219 = 1)) AND (value#219 
= 2))
        +- *(1) LocalTableScan [value#219]
     ```
     But after this PR it is:
     ```
     == Physical Plan ==
     LocalTableScan <empty>, [a#222]
     ```
   - Allows substitution in other than `EqualTo` and `EqualNullSafe` 
expressions:
     e.g. `a = 5 AND b < a + 3` => `a = 5 AND b < 8`
   - Gets rid of the `Option` wrapper from the return type of 
`ConstantPropagation.traverse()` as modern `.mapExpressions()`, 
`.withNewChildren()` and `.mapChildren()` methods can recognize if there was no 
change in arguments.
   
   ### Why are the changes needed?
   Improve performance.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   New UTs are taken from @wangyum's PR 
https://github.com/apache/spark/pull/40093
   


-- 
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]

Reply via email to