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

Jinfeng Ni commented on DRILL-3243:
-----------------------------------

I think for this particular query, ideally we should issue error in query 
planner, in stead of raising error in execution side.  The identifier 'tmp' in 
the where clause should be resolved as a column in the table.  Currently, 
Drill's dynamic table is schema-less, and hence it assumes any column might 
exists.  However, in this case, the dynamic table is a csv file, which only 
accepts 'columns' or '*'.  We should raise the error saying "column 'tmp' does 
not exists" in planner, when it tries to resolve the column reference 'tmp'. 
Essentially, for csv files, it behaviors kind like of schema-based table, since 
only two choices of columns are allowed.  That's exactly the behavior on 
Postgres or other schema-based system. 

Changing the execution side's error message seems not a good place for raising 
error for this particular query.

 

> Need a better error message - Use of alias in window function definition
> ------------------------------------------------------------------------
>
>                 Key: DRILL-3243
>                 URL: https://issues.apache.org/jira/browse/DRILL-3243
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Flow
>    Affects Versions: 1.0.0
>            Reporter: Khurram Faraaz
>            Assignee: Hanifi Gunes
>            Priority: Minor
>             Fix For: 1.2.0
>
>         Attachments: DRILL-3243.1.patch.txt, DRILL-3243.2.patch.txt
>
>
> Need a better error message when we use alias for window definition in query 
> that uses window functions. for example, OVER(PARTITION BY columns[0] ORDER 
> BY columns[1]) tmp, and if alias "tmp" is used in the predicate we need a 
> message that says, column "tmp" does not exist, that is how it is in Postgres 
> 9.3
> Postgres 9.3
> {code}
> postgres=# select count(*) OVER(partition by type order by id) `tmp` from 
> airports where tmp is not null;
> ERROR:  column "tmp" does not exist
> LINE 1: ...ect count(*) OVER(partition by type order by id) `tmp` from ...
>                                                              ^
> {code}
> Drill 1.0
> {code}
> 0: jdbc:drill:schema=dfs.tmp> select count(*) OVER(partition by columns[2] 
> order by columns[0]) tmp from `airports.csv` where tmp is not null;
> Error: SYSTEM ERROR: java.lang.IllegalArgumentException: Selected column(s) 
> must have name 'columns' or must be plain '*'
> Fragment 0:0
> [Error Id: 66987b81-fe50-422d-95e4-9ce61c873584 on centos-02.qa.lab:31010] 
> (state=,code=0)
> {code}



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

Reply via email to