mkleen opened a new pull request, #18298:
URL: https://github.com/apache/datafusion/pull/18298

   ## Which issue does this PR close?
   
   Closes https://github.com/apache/datafusion/issues/17830
   
   ## Rationale for this change
   
   The queries from the original ticket fail, because an unprojected 
`generate_series` function would produce in a join the wrong number of columns 
which leads to a runtime error.
   
   ## What changes are included in this PR?
   
   This adds a missing projection to `generate_series` to ensure values are 
emitted when projected. 
   
   ## Are these changes tested?
   
   I added a sql-logic test with relevant query. I also compared the results 
against Postgres and Duckdb:
   
   Postgres:
   ```sql
   mkleen=# SELECT v1 FROM (select generate_series as v1 from 
generate_series(1, 3)) g1, (select generate_series as v2 from 
generate_series(1, 3)) g2;
    v1
   ----
     1
     1
     1
     2
     2
     2
     3
     3
     3
   (9 rows)
   ```
   DuckDB:
   ```
   D SELECT v1 FROM (select generate_series as v1 from generate_series(1, 3)) 
g1, (select generate_series as v2 from generate_series(1, 3)) g2;
   ┌───────┐
   │  v1   │
   │ int64 │
   ├───────┤
   │     1 │
   │     2 │
   │     3 │
   │     1 │
   │     2 │
   │     3 │
   │     1 │
   │     2 │
   │     3 │
   └───────┘
   ```
    
   ## Are there any user-facing changes?
   
   No
   


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