Khurram Faraaz created DRILL-4902:
-------------------------------------
Summary: nested aggregate query does not complain about missing
GROUP BY clause
Key: DRILL-4902
URL: https://issues.apache.org/jira/browse/DRILL-4902
Project: Apache Drill
Issue Type: Bug
Components: Execution - Flow
Affects Versions: 1.9.0
Reporter: Khurram Faraaz
A nested aggregate windowed query does not report an error when the
partitioning column is not used in the GROUP BY clause.
Drill 1.9.0
This is the correct expected behavior.
{noformat}
0: jdbc:drill:schema=dfs.tmp> select count(max(c7)) over (partition by c8) from
`DRILL_4589`;
Error: VALIDATION ERROR: From line 1, column 42 to line 1, column 43:
Expression 'c8' is not being grouped
SQL Query null
[Error Id: 09c837b9-7a66-4a1f-9fbc-522160947274 on centos-01.qa.lab:31010]
(state=,code=0)
{noformat}
The below query too should report above error, as the GROUP BY on partitioning
column is missing.
{noformat}
0: jdbc:drill:schema=dfs.tmp> select count(max(c7)) over (partition by c8) from
(select * from `DRILL_4589`);
+---------+
| EXPR$0 |
+---------+
| 1 |
+---------+
1 row selected (193.71 seconds)
{noformat}
Postgres 9.3 also reports an error for a similar query
{noformat}
postgres=# select count(max(c1)) over (partition by c2) from (select * from
t222) sub_query;
ERROR: column "sub_query.c2" must appear in the GROUP BY clause or be used in
an aggregate function
LINE 1: select count(max(c1)) over (partition by c2) from (select * ...
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)