Github user gatorsmile commented on the pull request:

    https://github.com/apache/spark/pull/10259#issuecomment-163787017
  
    Thank you @davies ! 
    
    I guess we might still have a bug in the code. As long as any input 
variable is Null, the return result is `null`. Is that by design? 
    
    For example, we have an input value `3`, but the return result is 
`Row(null)`.
    ```scala
      test("SPARK-12258 UDF and Null value") {
        hiveContext.runSqlHive("CREATE TABLE test (ti TINYINT, si SMALLINT, i 
INT, bi BIGINT, " +
          "bo BOOLEAN, f FLOAT, d DOUBLE, s STRING, bin BINARY, t TIMESTAMP, da 
DATE)" +
          "STORED AS TEXTFILE")
        hiveContext.runSqlHive("INSERT INTO TABLE test VALUES(Null, Null, 3, 
Null, Null, " +
          "Null, Null, Null, Null, Null, Null)")
        hiveContext.udf.register("typeNullCheck",
          (ti: Byte, si: Short, i: Int, bi: Long, bo: Boolean, f: Float, d: 
Double, s: String,
           bin: Array[Byte], t: Timestamp, da: Date) =>
           (ti, si, i, bi, bo, f, d, s, bin, t, da))
        checkAnswer(
          sql("SELECT typeNullCheck(ti, si, i, bi, bo, f, d, s, bin, t, da) 
FROM test"),
          Row(null, null, null, null, null, null, null, null, null, null, null))
      }
    ```


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