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

    https://github.com/apache/spark/pull/20637#discussion_r212584773
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala
 ---
    @@ -223,8 +223,9 @@ trait ExpressionEvalHelper extends 
GeneratorDrivenPropertyChecks with PlanTestBa
               }
             } else {
               val lit = InternalRow(expected, expected)
    +          val dtAsNullable = expression.dataType.asNullable
    --- End diff --
    
    Good question. This change related to the part in the description
    ```
    On the other hand, expected will be converted to UnsafeArrayData(null) 
considering its value.
    ```
    
    Since this PR removes nullchecks in the generated code based on DataType of 
`expression`,  `null` in `expected` never converted to `null`. To forcefully 
insert null check in the generated code to convert `experted` to 
`UnsafeArrayData`, we need `asNullable`.
    
    Does it answer to this question? 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to