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

James Taylor commented on PHOENIX-2064:
---------------------------------------

Actually, you should leave position as-is. Add an ImmutableBytesWritable 
valuePtr member variable that you set with the result of ptr before returning. 
This will cache the end result (when we're incrementally evaluating) so it's 
not continually re-evaluated. Then, at the top of the evaluate, before the try, 
do this:
{code}
if (position == elements.length) {
    ptr.set(valuePtr.get(), valuePtr.getOffset(), valuePtr.getLength());
}
try {
    ....
{code}
also, in reset() do a valuePtr.set(ByteUtil.EMPTY_BYTE_ARRAY)

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



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

Reply via email to