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

rajeshbabu updated PHOENIX-1015:
--------------------------------

    Attachment: PHOENIX-1015_v9.patch

Thanks for the review [~jamestaylor].

bq. ReferencingColumn different than ColumnReference? Would it be possible to 
add what's missing to ColumnReference?
ReferencingColumn has only pointers to column family and qualifier, 
ColumnReference also has the pointers. But some cases better to use 
ReferencingColumn than ColumnRefernce because to create object of 
ColumnReference we need to get family and qualifier copies from each keyvalue 
which is expensive.
{code}
    public ValueGetter createGetterFromKeyValues(Collection<Cell> 
pendingUpdates) {
        final Map<ReferencingColumn, ImmutableBytesPtr> valueMap = 
Maps.newHashMapWithExpectedSize(pendingUpdates
                .size());
        for (Cell kv : pendingUpdates) {
            // create new pointers to each part of the kv
            ImmutableBytesPtr family = new 
ImmutableBytesPtr(kv.getRowArray(),kv.getFamilyOffset(),kv.getFamilyLength());
            ImmutableBytesPtr qual = new ImmutableBytesPtr(kv.getRowArray(), 
kv.getQualifierOffset(), kv.getQualifierLength());
            ImmutableBytesPtr value = new ImmutableBytesPtr(kv.getValueArray(), 
kv.getValueOffset(), kv.getValueLength());
            valueMap.put(new ReferencingColumn(family, qual), value);
        }
        return new ValueGetter() {
            @Override
            public ImmutableBytesPtr getLatestValue(ColumnReference ref) throws 
IOException {
                if(ref.equals(dataEmptyKeyValueRef)) return null;
                return valueMap.get(ReferencingColumn.wrap(ref));
            }
        };
    }   
{code}

bq. would you mind clarifying a bit in a comment when the WHERE clause would be 
null and a local index would be used (in QueryOptimizer)?
Added in the current patch.


> Support joining back to data table row from local index when query condition 
> involves leading columns in local index
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1015
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1015
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: rajeshbabu
>            Assignee: rajeshbabu
>         Attachments: PHOENIX-1015.patch, PHOENIX-1015_v6.patch, 
> PHOENIX-1015_v7.patch, PHOENIX-1015_v8.patch, PHOENIX-1015_v8.rar, 
> PHOENIX-1015_v9.patch
>
>
> When a query involves more columns to project than columns in index and query 
> condition involves leading columns in local index then first we can get 
> matching rowkeys from local index table and then get the required columns 
> from data table. In local index both data region and index region co-reside 
> in the same RS, we can call get on data region to get the missing columns in 
> the index, without any n/w overhead. So it's efficient. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to