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

Fredy Wijaya commented on IMPALA-7250:
--------------------------------------

I looked at the problem and it seems the group by isn't cast into a timestamp 
unlike the select expression. This is the rewritten SQL.

{noformat}
SELECT datediff(day, TIMESTAMP '2018-07-05 09:25:10.590533000')
FROM `default`.test_table WHERE day >= '2018-06-30 09:25:10.590533000'
GROUP BY datediff(day, '2018-07-05 09:25:10.590533000')
{noformat}


> AnalysisException in select datediff() with group by
> ----------------------------------------------------
>
>                 Key: IMPALA-7250
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7250
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.0, Impala 2.12.0
>            Reporter: Fredy Wijaya
>            Priority: Major
>
> {noformat}
> [localhost:21000] default> select datediff(day,now()) from test_table where 
> day>=(now() - interval 5 days) group by datediff(day,now());
> Query: select datediff(day,now()) from test_table where day>=(now() - 
> interval 5 days) group by datediff(day,now())
> Query submitted at: 2018-06-05 21:11:23 (Coordinator: http://impala-dev:25000)
> ERROR: AnalysisException: select list expression not produced by aggregation 
> output (missing from GROUP BY clause?): datediff(day, TIMESTAMP '2018-06-05 
> 21:11:23.320564000')
> [localhost:21000] default> set ENABLE_EXPR_REWRITES=0;
> ENABLE_EXPR_REWRITES set to 0
> [localhost:21000] default> select datediff(day,now()) from test_table where 
> day>=(now() - interval 5 days) group by datediff(day,now());
> Query: select datediff(day,now()) from test_table where day>=(now() - 
> interval 5 days) group by datediff(day,now())
> Query submitted at: 2018-06-05 21:11:31 (Coordinator: http://impala-dev:25000)
> Query progress can be monitored at: 
> http://impala-dev:25000/query_plan?query_id=b64c8eabcedc58e5:da9edc8600000000
> Fetched 0 row(s) in 0.21s
> {noformat}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to