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

    https://github.com/apache/spark/pull/11792#discussion_r57065601
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala ---
    @@ -110,23 +114,28 @@ case class Filter(condition: Expression, child: 
SparkPlan)
       override def doConsume(ctx: CodegenContext, input: Seq[ExprCode], row: 
String): String = {
         val numOutput = metricTerm(ctx, "numOutputRows")
     
    -    // filter out the nulls
    -    val filterOutNull = notNullAttributes.map { a =>
    -      val idx = child.output.indexOf(a)
    -      s"if (${input(idx).isNull}) continue;"
    -    }.mkString("\n")
    +    val conjuncts = splitConjunctivePredicates(condition)
     
    -    ctx.currentVars = input
    -    val predicates = otherPreds.map { e =>
    -      val bound = ExpressionCanonicalizer.execute(
    -        BindReferences.bindReference(e, output))
    -      val ev = bound.gen(ctx)
    +    // Generate the code to evaluate each filter.
    +    val generated = conjuncts.map { c =>
    --- End diff --
    
    I can not find where this assumption (IsNotNull come before) is guarateed, 
if not, we could generate wrong results.
    
    Also, the conjuncts is in the sequence like this: 
    
     IsNotNull(A), IsNotNull(B), A > xx, B > xxx
    
    We should re-order them explicitly, make sue they are in this order:
    
        IsNotNull(A), A > xx, IsNotNull(B), B > xxx



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