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

Lars Hofhansl commented on PHOENIX-2965:
----------------------------------------

Thanks [~giacomotaylor].
# DistinctCountAggregateFunction is only used in the first case. The 2nd case 
already works correctly.
# The check for {{!isUngroupedAggregate}} is needed to that the statement is 
not flagged as incorrect. Before my change it bailed out earlier (returning 
{{UNGROUPED_GROUP_BY}}), to use the optimization we need to check whether the 
DISTINCT part is order preserving or not.
# I'll check out the queries you mentioned. These are all interesting.
# Interestingly a COUNT(DISTINCT) will _not_ mark the statement as distinct. 
Could fix that, but I thought is safer to check explicitly. I do think all 
these checks are needed. I'll check the cases you mention.

Stand by :)

> Use DistinctPrefixFilter logic for COUNT(DISTINCT ...) and COUNT(...) GROUP BY
> ------------------------------------------------------------------------------
>
>                 Key: PHOENIX-2965
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2965
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Lars Hofhansl
>             Fix For: 4.8.0
>
>         Attachments: 2965-v2.txt, 2965-v3.txt, 2965.txt
>
>
> Parent uses skip scanning to optimize DISTINCT and certain GROUP BY 
> operations along the row key.
> COUNT queries are optimized differently, could be sped up significantly as 
> well.
> [~giacomotaylor], I might need to help into where COUNT(DISTINCT) queries are 
> planned and optimized.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to