andygrove opened a new issue, #367:
URL: https://github.com/apache/datafusion-spark/issues/367

   ### Describe the bug
   
   `array_contains` accepts an untyped NULL as either argument and returns 
NULL. Spark rejects an argument of NULL type when the query is analyzed.
   
   ### To Reproduce
   
   ```sql
   SELECT array_contains(NULL, 1);
   SELECT array_contains(array(1, 2, 3), NULL);
   ```
   
   datafusion-spark returns `NULL` for both.
   
   Spark 4.2.0 raises for both:
   
   ```
   [DATATYPE_MISMATCH.NULL_TYPE] Cannot resolve "array_contains(NULL, 1)" due 
to data type mismatch: Null typed values cannot be used as arguments of 
`array_contains`.
   ```
   
   ### Expected behavior
   
   The same error as Spark at planning time. A typed NULL, such as `CAST(NULL 
AS ARRAY<INT>)` or `CAST(NULL AS INT)`, still returns NULL, as it does in Spark.
   
   ### Additional context
   
   The records are in `array/array_contains.slt`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to