[ 
https://issues.apache.org/jira/browse/DRILL-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14556372#comment-14556372
 ] 

Jinfeng Ni commented on DRILL-2346:
-----------------------------------

For now, I think this is the expected behavior.

For select * against a schema-less table, the expanding to a list of regular 
columns happens at execution time, not at planning time. However, when Drill 
creates a view, the view creation does not involve query execution (execution 
happens only when you query against the created view). In stead, it simply goes 
through query parsing / semantics checking.  It doesn't seem  possible to 
expand * into a list of regular columns when execute a view DDL statement, at 
this moment.

Also, if you explicitly list the column names in the view's definition, one 
would argue that you may put those columns explicitly in the Select statement 
in stead.

{code}
create view v2 as select a2, b2, c2 from t2;
{code}

or if you want to rename the column into different names

{code}
create view v2 (a3, b3, c3) as select a2, b2, c2 from t2;

or

create view v2 as select a2 a3, b2 b3, c2 c3 from t2;
{code}


> Star is not expanded correctly in create view if view fields are specified
> --------------------------------------------------------------------------
>
>                 Key: DRILL-2346
>                 URL: https://issues.apache.org/jira/browse/DRILL-2346
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Victoria Markman
>            Assignee: Jinfeng Ni
>            Priority: Minor
>             Fix For: 1.1.0
>
>
> {code}
> 0: jdbc:drill:schema=dfs> select * from t2 limit 1;
> +------------+------------+------------+
> |     a2     |     b2     |     c2     |
> +------------+------------+------------+
> | 0          | zzz        | 2014-12-31 |
> +------------+------------+------------+
> 1 row selected (0.065 seconds)
> {code}
> We get an error, even though table t2 has 3 columns:
> {code}
> 0: jdbc:drill:schema=dfs> create view v2(a2, b2, c2) as select * from t2;
> +------------+------------+
> |     ok     |  summary   |
> +------------+------------+
> | false      | View's field list and View's query field list have different 
> counts. |
> +------------+------------+
> 1 row selected (0.038 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to