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

   ### Describe the bug
   
   `stack` accepts a column of NULL type next to a column of another type in 
the same output position. Spark's analyzer rejects it. Spark converts a NULL 
literal to the type of the other values, but not a column whose type is NULL 
(`VOID`).
   
   ### To Reproduce
   
   ```sql
   SELECT stack(2, a, b) FROM (VALUES (1, NULL), (NULL, NULL)) AS t(a, b);
   ```
   
   datafusion-spark returns `[{col0: 1}, {col0: NULL}]` and `[{col0: NULL}, 
{col0: NULL}]`.
   
   Spark 4.2.0 raises:
   
   ```
   [DATATYPE_MISMATCH.STACK_COLUMN_DIFF_TYPES] Cannot resolve "stack(2, a, b)" 
due to data type mismatch: The data type of the column (0) do not have the same 
type: "INT" (1) <> "VOID" (2).
   ```
   
   ### Expected behavior
   
   The same error as Spark at planning time. A NULL literal, as in `stack(2, 
NULL, a)`, is still accepted.
   
   ### Additional context
   
   Found with the PySpark runner. The record is in `generator/stack.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