You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/11 21:56:29 UTC

[GitHub] [arrow-datafusion] DaltonModlin opened a new issue, #3108: Allow inline column aliases for create view

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] andygrove commented on issue #3108: Allow inline column aliases for create view

Posted by GitBox <gi...@apache.org>.
andygrove commented on issue #3108:
URL: https://github.com/apache/arrow-datafusion/issues/3108#issuecomment-1213169241

   It looks like this is already supported in the underlying SQL parser, so should be easy to add.


-- 
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@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] andygrove commented on issue #3108: Allow inline column aliases for create view

Posted by GitBox <gi...@apache.org>.
andygrove commented on issue #3108:
URL: https://github.com/apache/arrow-datafusion/issues/3108#issuecomment-1213166655

   The proposal is valid under Postgres syntax.
   
   https://www.postgresql.org/docs/9.2/sql-createview.html
   
   ```
   CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW name [ ( column_name [, ...] ) ]
       [ WITH ( view_option_name [= view_option_value] [, ... ] ) ]
       AS query
   ```


-- 
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@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] andygrove closed issue #3108: Allow inline column aliases for create view

Posted by GitBox <gi...@apache.org>.
andygrove closed issue #3108: Allow inline column aliases for create view
URL: https://github.com/apache/arrow-datafusion/issues/3108


-- 
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@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org