andylam-db commented on code in PR #52699:
URL: https://github.com/apache/spark/pull/52699#discussion_r2823597551
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -162,31 +269,31 @@ object ConstantPropagation extends Rule[LogicalPlan] {
* 2. AttributeMap: propagated mapping of attribute => constant
*/
private def traverse(condition: Expression, replaceChildren: Boolean,
nullIsFalse: Boolean)
- : (Option[Expression], AttributeMap[(Literal, BinaryComparison)]) =
+ : (Option[Expression], AttributeMap[(Literal, BinaryComparison)]) =
Review Comment:
Maybe we can write the following function and call it from
InferFiltersFromConstraints, instead of the additional logic above?
```
/**
* Substitutes [[Attribute Attributes]] which can be statically evaluated
with their corresponding
* value in conjunctive [[Expression Expressions]]. This opens up the main
logic in this rule to
* be used externally.
*/
def replaceAttributesWithConstants(condition: Expression):
Option[Expression] = {
val (newCondition, _) = traverse(condition, replaceChildren = true,
nullIsFalse = true)
newCondition
}
```
--
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]