You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Dumindu Buddhika (JIRA)" <ji...@apache.org> on 2015/07/06 15:55:04 UTC

[jira] [Updated] (PHOENIX-2063) Row value constructor doesn't work when used in COUNT DISTINCT

     [ https://issues.apache.org/jira/browse/PHOENIX-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dumindu Buddhika updated PHOENIX-2063:
--------------------------------------
    Attachment: PHOENIX-2063-v1.patch

[~jamestaylor], [~ram_krish] I have looked at this issue. This occurs because counter variable in RowValueConstructor does not get reset for each row. so the first for loop in evaluate only runs for the first row. Then as counter is already equal to ptrs.length loop is skipped.
{code}
for(j = counter; j < ptrs.length; j++) {
{code} 
also ptrs and estimatedByteSize should also be reset after each evaluate call.

I have called reset() method in the beginning of the evaluate method. This solves the issue. But I am not sure whether it is the correct way to do it. Or is it better to make counter, ptrs, estimatedByteSize as local variables in evaluate method?

> Row value constructor doesn't work when used in COUNT DISTINCT
> --------------------------------------------------------------
>
>                 Key: PHOENIX-2063
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2063
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Dumindu Buddhika
>         Attachments: PHOENIX-2063-v1.patch
>
>
> As a workaround for PHOENIX-2062, I tried the following query:
> {code}
> SELECT COUNT(DISTINCT (a.col1, b.col2)) ...
> {code}
> However, this always returns 1 as the COUNT DISTINCT which is wrong.



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