Github user maryannxue commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20816#discussion_r178328704
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -669,11 +672,42 @@ object InferFiltersFromConstraints extends 
Rule[LogicalPlan] with PredicateHelpe
           val newConditionOpt = conditionOpt match {
             case Some(condition) =>
               val newFilters = additionalConstraints -- 
splitConjunctivePredicates(condition)
    -          if (newFilters.nonEmpty) Option(And(newFilters.reduce(And), 
condition)) else None
    +          if (newFilters.nonEmpty) Option(And(newFilters.reduce(And), 
condition)) else conditionOpt
    --- End diff --
    
    So what would be the benefit of keeping that unchanged? To me, it would 
make the code look confusing. And in theory the two parts (1. infer 
`newConditionOpt`; 2. infer `newLeftOp` or `newRightOpt`) will be 
unsynchronized, leaving part 2 always one iteration behind part 1.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to