mslapek opened a new issue, #5733:
URL: https://github.com/apache/arrow-datafusion/issues/5733
### Describe the bug
Case statement, where the first branch is `NULL` and another one is a number
causes "Mismatch between schema and batches" error.
In batch schema, such column has `Int32` datatype (or some similar).
In plan schema, such columns have an invalid datatype `Null`.
### To Reproduce
Add this to the middle of `pg_compat_union.slt`:
```
statement ok
CREATE TABLE aggregate_test_100_nullable_by_sql AS
SELECT
*,
CASE
WHEN c4 % 3 = 0 THEN NULL
ELSE c5
END AS n5,
CASE
WHEN c3 % 3 != 0 THEN c9
ELSE NULL
END AS n9
FROM aggregate_test_100_by_sql
```
Under Postgres this statement succeeds.
### Expected behavior
To have the same behavior as Postgres: success.
### Additional context
_No response_
--
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]