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

Lars Hofhansl commented on PHOENIX-3158:
----------------------------------------

That happens even though the DistinctPrefixFilter is not even used in this 
case. It has to do with the plan massaging done in this case.
{noformat}
select /*+ RANGE_SCAN */ count(distinct(pk1)) from test1 where c1 < 0;
+------------------------+
| DISTINCT_COUNT("PK1")  |
+------------------------+
| 0                      |
+------------------------+

select count(distinct(pk1)) from test1 where c1 < 0;
+------------------------+
| DISTINCT_COUNT("PK1")  |
+------------------------+
+------------------------+

explain select /*+ RANGE_SCAN */ count(distinct(pk1)) from test1 where c1 < 0;
+-----------------------------------------------------------------------------------------------+
|                                             PLAN                              
                |
+-----------------------------------------------------------------------------------------------+
| CLIENT 4-CHUNK 566237 ROWS 41943207 BYTES PARALLEL 4-WAY RANGE SCAN OVER 
TEST1 [1,*] - [1,0]  |
|     SERVER FILTER BY FIRST KEY ONLY                                           
                |
|     SERVER AGGREGATE INTO SINGLE ROW                                          
                |
+-----------------------------------------------------------------------------------------------+


explain select count(distinct(pk1)) from test1 where c1 < 0;
+-----------------------------------------------------------------------------------------------+
|                                             PLAN                              
                |
+-----------------------------------------------------------------------------------------------+
| CLIENT 4-CHUNK 566237 ROWS 41943207 BYTES PARALLEL 4-WAY RANGE SCAN OVER 
TEST1 [1,*] - [1,0]  |
|     SERVER FILTER BY FIRST KEY ONLY                                           
                |
|     SERVER AGGREGATE INTO SINGLE ROW                                          
                |
| CLIENT MERGE SORT                                                             
                |
+-----------------------------------------------------------------------------------------------+
{noformat}

> COUNT(DISTINCT) may return null install of 0 after PHOENIX-258
> --------------------------------------------------------------
>
>                 Key: PHOENIX-3158
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3158
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Lars Hofhansl
>             Fix For: 4.8.1
>
>         Attachments: 3158.txt
>
>
> This is fine to fix in 4.8.1.
> I'll attach a test to indicate the issue.



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

Reply via email to