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

Victoria Markman commented on DRILL-2190:
-----------------------------------------

Sean,

It does not seem to work in the latest 1.2.0 ... not critical though ...

#Fri Sep 04 00:17:59 UTC 2015
git.commit.id.abbrev=9baec8a

{code}
0: jdbc:drill:schema=dfs> select distinct count(distinct a1) from t1 group by 
b1 order by 1;
Error: PARSE ERROR: From line 1, column 32 to line 1, column 65: Expression 
'COUNT(`t1`.`a1`)' is not in the select clause
[Error Id: bbb11315-52ee-4cf6-a283-8e69f13c701d on atsqa4-133.qa.lab:31010] 
(state=,code=0)

0: jdbc:drill:schema=dfs> select distinct count(distinct a1) from t1 group by 
b1 order by count(distinct a1);
Error: PARSE ERROR: From line 1, column 65 to line 1, column 82: Expression 
'COUNT(DISTINCT `a1`)' is not in the select clause


[Error Id: b51dab80-c9ad-465f-b867-676abb84b6d8 on atsqa4-133.qa.lab:31010] 
(state=,code=0)

0: jdbc:drill:schema=dfs> select  distinct sum(a1) from t1 group by b1 order by 
1;
Error: PARSE ERROR: From line 1, column 22 to line 1, column 55: Expression 
'SUM(`t1`.`a1`)' is not in the select clause
[Error Id: 334282b0-2135-4490-9971-4c9fbdb069ac on atsqa4-133.qa.lab:31010] 
(state=,code=0)

0: jdbc:drill:schema=dfs> select  distinct sum(a1) as x from t1 group by b1 
order by x;
Error: PARSE ERROR: From line 1, column 22 to line 1, column 60: Expression 
'SUM(`t1`.`a1`)' is not in the select clause
[Error Id: 6f8d5c2a-0c39-4dda-8a41-9f7e8a247dbf on atsqa4-133.qa.lab:31010] 
(state=,code=0)
{code}

> Failure to order by function if DISTINCT clause is present
> ----------------------------------------------------------
>
>                 Key: DRILL-2190
>                 URL: https://issues.apache.org/jira/browse/DRILL-2190
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Victoria Markman
>            Assignee: Sean Hsuan-Yi Chu
>             Fix For: 1.2.0
>
>
> {code}
> 0: jdbc:drill:schema=dfs> select * from t1;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 1          | aaaaa      | 2015-01-01 |
> | 2          | bbbbb      | 2015-01-02 |
> | 3          | ccccc      | 2015-01-03 |
> | 4          | null       | 2015-01-04 |
> | 5          | eeeee      | 2015-01-05 |
> | 6          | fffff      | 2015-01-06 |
> | 7          | ggggg      | 2015-01-07 |
> | null       | hhhhh      | 2015-01-08 |
> | 9          | iiiii      | null       |
> | 10         | jjjjj      | 2015-01-10 |
> +------------+------------+------------+
> 10 rows selected (0.092 seconds)
> 0: jdbc:drill:schema=dfs> select distinct count(distinct a1) from t1 group by 
> b1 order by 1;
> Query failed: SqlValidatorException: Expression 'COUNT(`t1`.`a1`)' is not in 
> the select clause
> Error: exception while executing query: Failure while executing query. 
> (state=,code=0)
> {code}
> Replaced ordinal with function: fails
> {code}
> 0: jdbc:drill:schema=dfs> select distinct count(distinct a1) from t1 group by 
> b1 order by count(distinct a1);
> Query failed: SqlValidatorException: Expression 'COUNT(DISTINCT `a1`)' is not 
> in the select clause
> Error: exception while executing query: Failure while executing query. 
> (state=,code=0)
> {code}
> Different aggregate function without DISTINCT clause: fails
> {code}
> 0: jdbc:drill:schema=dfs> select  distinct sum(a1) from t1 group by b1 order 
> by 1;
> Query failed: SqlValidatorException: Expression 'SUM(`t1`.`a1`)' is not in 
> the select clause
> Error: exception while executing query: Failure while executing query. 
> (state=,code=0)
> {code}
> Added alias to the function and order by alias: fails
> {code}
> 0: jdbc:drill:schema=dfs> select  distinct sum(a1) as x from t1 group by b1 
> order by x;
> Query failed: SqlValidatorException: Expression 'SUM(`t1`.`a1`)' is not in 
> the select clause
> Error: exception while executing query: Failure while executing query. 
> (state=,code=0)
> {code}



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

Reply via email to