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

    https://github.com/apache/spark/pull/10444#discussion_r48332590
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 ---
    @@ -47,6 +48,34 @@ trait Predicate extends Expression {
       override def dataType: DataType = BooleanType
     }
     
    +object Predicate extends PredicateHelper {
    +  def toCNF(predicate: Expression, maybeThreshold: Option[Double] = None): 
Expression = {
    +    val cnf = new CNFExecutor(predicate).execute(predicate)
    +    val threshold = maybeThreshold.map(predicate.size * 
_).getOrElse(Double.MaxValue)
    +    if (cnf.size > threshold) predicate else cnf
    --- End diff --
    
    When the threshold is exceeded, the original predicate rather than the 
intermediate converted predicate is returned. This because the intermediate 
result may not be in CNF, thus:
    
    1. It doesn't bring much benefit for filter push-down, and
    2. It's much larger than the original predicate and brings extra evaluation 
cost.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to