findepi opened a new issue, #12292:
URL: https://github.com/apache/datafusion/issues/12292
### Describe the bug
```
> SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(2) x UNION ALL
SELECT make_array(now()) x);
+---------------------------+
| arrow_typeof(x[Int64(0)]) |
+---------------------------+
| Int64 |
+---------------------------+
```
but same query with union branches swapped gives different return type
```
> SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(now()) x UNION
ALL SELECT make_array(2) x);
+---------------------------------------+
| arrow_typeof(x[Int64(0)]) |
+---------------------------------------+
| Timestamp(Nanosecond, Some("+00:00")) |
+---------------------------------------+
```
### To Reproduce
```
SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(2) x UNION ALL
SELECT make_array(now()) x);
SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(now()) x UNION
ALL SELECT make_array(2) x);
```
### Expected behavior
The schema (output type) of `UNION ALL` should not depend on syntactic order
of union's branches.
### 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]