alamb opened a new issue, #17830:
URL: https://github.com/apache/datafusion/issues/17830

   ### Describe the bug
   
   This query should work but errors
   
   ### To Reproduce
   
   ```sql
   > SELECT v1 FROM (select "value" as v1 from generate_series(1, 100) as g1), 
(select "value" as v2 from generate_series(1, 100) as g2);
   Arrow error: Invalid argument error: number of columns(2) must match number 
of fields(1) in schema
   ```
   
   ### Expected behavior
   
   The equivalent query works fine in DuckDB:
   
   ```sql
   D SELECT v1 FROM (SELECT * FROM (select "generate_series" as v1 from 
generate_series(1, 100) as g1), (select "generate_series" as v2 from 
generate_series(1, 100) as g2));
   ┌────────────┐
   │     v1     │
   │   int64    │
   ├────────────┤
   │          1 │
   │          2 │
   │          3 │
   │          4 │
   │          5 │
   │          6 │
   │          7 │
   │          8 │
   │          9 │
   ...
   │         96 │
   │         97 │
   │         98 │
   │         99 │
   │        100 │
   ├────────────┤
   │ 10000 rows │
   │ (40 shown) │
   └────────────┘
   ```
   
   ### Additional context
   
   It seems like it is related to `generate_series` as an equivalent query with 
tables seems to work fine
   
   ```sql
   > create table g1 as values (1);
   0 row(s) fetched.
   Elapsed 0.004 seconds.
   
   > create table g2 as values (1);
   0 row(s) fetched.
   Elapsed 0.001 seconds.
   
   > select g1.column1 from (select * from g1) CROSS JOIN (select * from g2);
   +---------+
   | column1 |
   +---------+
   | 1       |
   +---------+
   ```


-- 
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