Curricane opened a new issue, #14132:
URL: https://github.com/apache/datafusion/issues/14132
### Describe the bug
create view with multi union use the first union schema as the final view
schema. eg:
use the latest datafusion-cli
```sql
CREATE UNBOUNDED EXTERNAL TABLE test1 (
id INT NOT NULL,
id1 INT NOT NULL,
)
STORED AS CSV
LOCATION '/home/cc/demo1.csv';
CREATE UNBOUNDED EXTERNAL TABLE test2 (
id INT NOT NULL,
id1 INT,
)
STORED AS CSV
LOCATION '/home/cc/demo2.csv';
CREATE VIEW adv_001
AS
SELECT id, id1 from test1
UNION ALL
SELECT id, id1 from test2;
CREATE VIEW adv_002
AS
SELECT id, id1 from test2
UNION ALL
SELECT id, id1 from test1;
```
when describe adv_001 and adv_002,get different result
```log
> describe adv_001;
+-------------+-----------+-------------+
| column_name | data_type | is_nullable |
+-------------+-----------+-------------+
| id | Int32 | NO |
| id1 | Int32 | NO |
+-------------+-----------+-------------+
2 row(s) fetched.
Elapsed 0.002 seconds.
> describe adv_002;
+-------------+-----------+-------------+
| column_name | data_type | is_nullable |
+-------------+-----------+-------------+
| id | Int32 | NO |
| id1 | Int32 | YES |
+-------------+-----------+-------------+
2 row(s) fetched.
Elapsed 0.002 seconds
```
In other words, if there are multiple UNION when creating a view, the schema
of multiple UNIONs will not be processed, such as TypeCoercion
### To Reproduce
see describe
### Expected behavior
if there are multiple UNION when creating a view, the schema of multiple
UNIONs should be processed, such as TypeCoercion
### Additional context
I will fix it.
--
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]