-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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 #166 for additional context on that issue, or see benchmarks/queries/q15.sql
for the actual TPCH query 15 statement.