Here is the corret result of the sql below:
select datediff(day,now()) from test_table where day>='2018-06-01' group by 
datediff(day,now());

| datediff(day, now()) |
+----------------------+
| -4                   |
| 0                    |
| -3                   |
| -1                   |
| -2                   |




2018-06-05 
skyyws 



发件人:skyyws <sky...@163.com>
发送时间:2018-06-05 21:44
主题:A question about AnalysisException
收件人:"dev@impala.apache.org"<dev@impala.apache.org>
抄送:

Hello all,
Recently, I found a probelm when I used impala to do ad-hoc analysis. When I 
executed the sql below:
select datediff(day,now()) from test_table where day>=(now() - interval 5 days) 
group by datediff(day,now());
I got an exception like this:
-----------------------------------------------------------------------------------------------------------------------------
Status: AnalysisException: select list expression not produced by aggregation 
output (missing from GROUP BY clause?): datediff(day, TIMESTAMP '2018-06-05 
21:24:28.403393000')
-----------------------------------------------------------------------------------------------------------------------------
and if I execute this sql:
select datediff(day,now()) from test_table where day>='2018-06-01' group by 
datediff(day,now());
I got the correct result like this:

This situation happend both on 2.10.0 and 3.0.0 version.
I'm not sure it's a bug or it's just designed like this, anyone who can give me 
some advice? Thanks.
(test_table is stored as parquet, and day is the partition column, string type.)
--------------------------------------------------------------------------------
2018-06-05
skyyws 

Reply via email to