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

James Taylor commented on PHOENIX-3667:
---------------------------------------

This looks good, except for the EncodedCQIncrementalResultTuple.getValue(int 
index) call. When used, this call allows the Cells to be iterated over like 
this:
{code}
    for (int i = 0; i < tuple.size(); i++) {
        System.out.println( tuple.getValue(i) );
    }
{code}
Here's how I'd recommend implementing getCellForIndex (with a javadoc comment 
that let's folks know it won't perform well):
{code}
    public void Cell getCellAtIndex(int index) {
        int bitIndex;
        for (bitIndex = filteredQualifiers.nextSetBit(0); bitIndex >= 0 && 
index >= 0; bitIndex = filteredQualifiers.nextSetBit(bitIndex+1)) {
            index--;
        }
        if (bitIndex < 0) {
            throw new NoSuchElementException();
        }
        return filteredCells[bitIndex];
    }
{code}    


> Optimize BooleanExpressionFilter for tables with encoded columns
> ----------------------------------------------------------------
>
>                 Key: PHOENIX-3667
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3667
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Samarth Jain
>         Attachments: PHOENIX-3667.patch, PHOENIX-3667_wip.patch, 
> WhereClause.jpg
>
>
> The client side of Phoenix determines the subclass of BooleanExpressionFilter 
> we use based on how many column families and column qualifiers are being 
> referenced. The idea is to minimize the lookup cost during filter evaluation. 
> For encoded columns, instead of using a Map or Set, we can create a few new 
> subclasses of BooleanExpressionFilter that use an array instead. No need for 
> any lookups or equality checks - just fill in the position based on the 
> column qualifier value instead. Since filters are applied on every row 
> between the start/stop key, this will improve performance quite a bit.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to