You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Curricane (via GitHub)" <gi...@apache.org> on 2025/01/15 09:39:36 UTC
[I] create view with multi union use the first union schema as the final view schema [datafusion]
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] create view with multi union use the first union schema as the final view schema [datafusion]
Posted by "matthewmturner (via GitHub)" <gi...@apache.org>.
matthewmturner commented on issue #14132:
URL: https://github.com/apache/datafusion/issues/14132#issuecomment-2593195210
@xudong963 this sounds similar to the issue we saw?
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] create view with multi union use the first union schema as the final view schema [datafusion]
Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao closed issue #14132: create view with multi union use the first union schema as the final view schema
URL: https://github.com/apache/datafusion/issues/14132
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org