DaltonModlin opened a new issue, #3108:
URL: https://github.com/apache/arrow-datafusion/issues/3108

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   I'd like to enable SQL statements with the form:
   ```
   CREATE VIEW view_name (c1_alias, c2_alias) AS
       SELECT
           column_name_1
           column_name_2
       FROM
           original_table
   ```
   
   **Describe the solution you'd like**
   
   In `datafusion/sql/src/planner.rs` on line 192, there is a check for empty 
columns before processing a create view statement. This empty column check 
stops inline create view statements like the one above as the columns are 
populated by the column aliases - in this case c1 and c2. I suggest removing 
the empty column check, and adding a few relevant tests (maybe within  
`datafusion/core/src/datasource/view.rs`?) to check everything is still in 
working order.
   
   **Describe alternatives you've considered**
   We could not do this and instead require that CREATE VIEW statements with 
column aliases are of the form:
   ```
   CREATE VIEW view_name AS
       SELECT
           column_name_1 AS c1,
           column_name_2 AS c2,
       FROM
           original_table
   ```
   
   **Additional context**
   This change would assist in getting all TPCH queries to pass, in particular 
query #15.
   See https://github.com/apache/arrow-datafusion/issues/166 for additional 
context on that issue, or see `benchmarks/queries/q15.sql` for the actual TPCH 
query 15 statement.
   


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

Reply via email to