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

    https://github.com/apache/spark/pull/482#discussion_r12122492
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
 ---
    @@ -223,6 +222,11 @@ abstract class Expression extends TreeNode[Expression] 
{
       }
     }
     
    +/**
    + * Root class for rewritten 2 operands UDF expression. By default, we 
assume it produces Null if 
    + * either one of its operands is null. Exceptional case requires to update 
the optimization rule 
    + * at [[optimizer.ConstantFolding ConstantFolding]]
    + */
     abstract class BinaryExpression extends Expression with 
trees.BinaryNode[Expression] {
    --- End diff --
    
    I know I said this was maybe an okay idea, but looking at this closer I'm 
worried that the semantics here are too subtle, even with the added 
documentation.  For example, I'm pretty sure we are introducing a bunch of bugs 
by making this existing class the marker for "null if children are null".  This 
is because `BinaryPredicate` inherits from `BinaryExpression` but predicates 
are not always null if one of their children is null.
    
    Instead maybe in the Rule should more explicitly name classes that can be 
null simplified.  For example, I think it is safe to do it on 
`BinaryArithmetic`.


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