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

    https://github.com/apache/spark/pull/1428#discussion_r14981973
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -171,6 +171,9 @@ object NullPropagation extends Rule[LogicalPlan] {
               case Literal(candidate, _) if candidate == v => true
               case _ => false
             })) => Literal(true, BooleanType)
    +      case e @ Substring(Literal(null, _), _, _) => Literal(null, 
e.dataType)
    --- End diff --
    
    @rxin, thank you for your comment.
    The rule `ConstantFolding` can be applied only if the expression is 
foldable, i.e. ALL of the child expressions are foldable, and the 
`NullPropagation` covers the case there exists at least one `null` literal 
regardless of foldabilities of the others.
    So I think the cases are needed.
    
    BTW, `Substring` can be foldable, right?


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

Reply via email to