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

Jacky Yin edited comment on CALCITE-4599 at 6/29/21, 2:53 AM:
--------------------------------------------------------------

Hello [~julianhyde],

The TVF 'tumble' can be used without aggregation. However, the date_histogram 
function is only supported with aggregation in elastic search. So it seems not 
proper to simply push down the TVF 'tumble'. How about the legacy window 
grouping function 'tumble' like below? 
{code:java}
select tumble_start(ts, interval '1' minute) as window_s, count(*) as cc from 
table1 group by tumble(ts, interval '1' minute){code}
I know it will be deprecated in the future. So is it still worthwhile to 
implement it? 


was (Author: jackyyin):
Hello [~julianhyde],

The TVF 'tumble' can be used without aggregation. However, the date_histogram 
function is only supported with aggregation in elastic search. So it seems not 
proper to push down the TVF 'tumble'. How about the legacy window grouping 
function 'tumble' like below? 
{code:java}
select tumble_start(ts, interval '1' minute) as window_s, count(*) as cc from 
table1 group by tumble(ts, interval '1' minute){code}

> Support push-down of "date histogram aggregation" in elastic search adapter
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-4599
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4599
>             Project: Calcite
>          Issue Type: Improvement
>          Components: elasticsearch-adapter
>            Reporter: Jacky Yin
>            Priority: Critical
>
> "date histogram aggregation" is one of the most popular analysis function of 
> elastic search. It is not pushed down to elastic search in current calcite es 
> adapter. Is there any plan to support it? Given the below example, if it can 
> be pushed down to es, the query should be very efficient. 
> {code:java}
> select count as cc from t group by date_histogram(`@timestamp`, interval '5' 
> minute){code}
> Another question is currently there seems no proper sql function/keyword for 
> date_histogram.  One possible option is TUMBLE function. Is it right? 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to