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

Vitalii Diravka commented on DRILL-6995:
----------------------------------------

I think in the last case Drill wrongly pushes Project to the Scan operator, see 
wrong _columns_ in the plan:
{noformat}
00-05              HashAgg(group=[{0}], agg#0=[COUNT($1)]) : rowType = 
RecordType(ANY department_id, BIGINT $f1): rowcount = 46.3, cumulative cost = 
...
00-06                Scan(table=[[cp, employee.json]], groupscan=[EasyGroupScan 
[selectionRoot=classpath:/employee.json, numFiles=1, columns=[`department_id`, 
`c`], files=[classpath:/employee.json]]]) : rowType = RecordType(ANY 
department_id, ANY c): rowcount = 463.0, cumulative cost = ...
{noformat}

> Count() function is not working with columns alias
> --------------------------------------------------
>
>                 Key: DRILL-6995
>                 URL: https://issues.apache.org/jira/browse/DRILL-6995
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.15.0
>            Reporter: Denys Ordynskiy
>            Priority: Major
>
> The query works correctly if I use column name in the count() function:
> {code:java}
> select department_id c from cp.`employee.json` group by c having 
> count(department_id) > 1
> {code}
> |c|
> |1|
> |2|
> |3|
> |11|
> |5|
> |4|
> |19|
> |14|
> |15|
> |16|
> But when I set column alias "c" in the count() function, Drill returns *an 
> empty result set*:
> {code:java}
> select department_id c from cp.`employee.json` group by c having count(c) > 1
> {code}
> |c|
> | |



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to