prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.08k stars 5.39k forks source link

Druid doesn't support aggregation on top of the aggregated data #15098

Open beepupa opened 4 years ago

beepupa commented 4 years ago

versions:presto:0.237,druid:0.17 conf image in presto image in druid image

mbasmanova commented 4 years ago

CC: @zhenxiao @luohao

beepupa commented 4 years ago

why add DATE_TRUNC('MONTH',"time") "time" is work image

beinan commented 4 years ago

why add DATE_TRUNC('MONTH',"time") "time" is work image

For this query, druid connector is not pushing down the aggregation group by to druid, because there is 'unsupported' function in your group-by clause. In this case, druid connector will fetching all the rows from druid and perform the aggregation on the presto side.

Why your original is not working: Because druid connector is trying to push down the 'group by' clause to druid, but looks like we thought druid cannot do aggregation on aggregated data ( as well as do aggregation on the data with limit). Anyway, I think it might be something we can improve. At least, we should not make the original query fail I think.

beepupa commented 4 years ago

为什么添加DATE_TRUNC('MONTH',“ time”)“ time”是可行的 图片

对于此查询,group by由于您的group-by子句中存在“不受支持”的功能,因此druid连接器不会将聚合向下推至druid。在这种情况下,德鲁伊连接器将从德鲁伊获取所有行,并在presto一侧执行聚合。

为什么您的原始 文档不起作用:因为druid连接器试图将'group by'子句下推到druid,但看起来我们认为druid无法对聚合数据进行聚合(以及对具有限制的数据进行聚合)。无论如何,我认为这可能是我们可以改进的。至少,我认为我们不应使原始查询失败。

Thank you for your reply. I found that many statements can be executed in Druid but not in Presto. Looking forward to the optimized version

beinan commented 4 years ago

Hey @beepupa many thanks for reporting these to us! I would keep this issue updated once we made any progress.

I really appreciate if you can post the problematic queries statements you found under this issue. It would be very helpful, thanks!

beepupa commented 4 years ago

嘿@beepupa非常感谢您向我们报告这些!一旦取得任何进展,我将保持此问题的更新。

如果您可以发布在此问题下发现的有问题的查询语句,我将不胜感激。这将非常有帮助,谢谢!

image