Github user EntilZha commented on the pull request:

    https://github.com/apache/spark/pull/7580#issuecomment-124183259
  
    There seems to be a number of different cases, so I am going to refer to 
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFArrayContains.java#L53-L129
 to see what expected behavior should be. I also ran these queries here: 
http://demo.gethue.com/beeswax.
    
    ```sql
    # This fails with a type error since null type does not match int type
    array_contains(array(1, 2, null), null)
    
    # This returns false, so as long as the expected type matches, it accepts 
null and returns false
    array_contains(array(1, 2, null), array(1, null)[1])
    
    # This returns a type error, so we should not do any casting
    array_contains(array(1L, 2L, null), 1)
    
    # This returns a type error
    array_contains(null, 1)
    
    # This returns false
    array_contains(array(array(1, 2), null)[1], 1)
    ```
    
    Based on running that, I am going to rewrite some of the type checking code 
to match this. Is there something for expecting errors on execution, or should 
I just use scala unit testing expects error?


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