[
https://issues.apache.org/jira/browse/PHOENIX-2965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15316891#comment-15316891
]
James Taylor commented on PHOENIX-2965:
---------------------------------------
Nothing is hardcoded. Aggregate functions are mapped to built-in functions in
Phoenix derived from {{AggregateFunction}}. For example, SUM is mapped to
{{SumAggregateFunction}}, COUNT is mapped to {{CountAggregateFunction}}, and
COUNT(DISTINCT) is mapped to {{DistinctCountAggregateFunction}}.
We cannot use the DistinctPrefixFilter optimization when an aggregate function
is used as we need to traverse all rows to perform some kind of calculation
(count, sum, etc). In the case of DISTINCT or GROUP BY without any usage of
aggregate functions (which is what SELECT DISTINCT queries get compiled into),
we can skip rows because we're not calculating anything per row.
> 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
>
>
> 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)