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

Kyle Buzsaki commented on PHOENIX-1211:
---------------------------------------

what about the case here:
{code}

                // Increment key and backtrack until in range. We know at this 
point that we'll be
                // issuing a seek next hint.
                seek = true;
                Arrays.fill(position, i, position.length, 0);
                int j  = i - 1;  // should this be "i - (slotSpan[i] + 1)" 
instead?   <-----------------------
                // If we're positioned at a single key, no need to copy the 
current key and get the next key .
                // Instead, just increment to the next key and continue.
                boolean incremented = false;
                while (j >= 0 && slots.get(j).get(position[j]).isSingleKey() && 
(incremented=true) && (position[j] = (position[j] + 1) % slots.get(j).size()) 
== 0) {
                    j -= slotSpan[i] + 1;
                    incremented = false;
                }
{code}

or here:
{code}

                if (incremented) {
                    // Continue the loop after setting the start key, because 
our start key maybe smaller than
                    // the current key, so we'll end up incrementing the start 
key until it's bigger than the
                    // current key.
                    setStartKey();
                    schema.reposition(ptr, i, j, minOffset, maxOffset);
                } else {
                    int currentLength = setStartKey(ptr, minOffset, j+1); // 
should this be j + slotSpan[j] + 1  <-----------------------
                    // From here on, we use startKey as our buffer (resetting 
minOffset and maxOffset)
                    // We've copied the part of the current key above that we 
need into startKey
                    // Reinitialize the iterator to be positioned at previous 
slot position
                    minOffset = 0;
                    maxOffset = startKeyLength;
                    schema.iterator(startKey, minOffset, maxOffset, ptr, j+1);  
// should this be j + slotSpan[j] + 1  <-----------------------
                    // Do nextKey after setting the accessor b/c otherwise the 
null byte may have
                    // been incremented causing us not to find it
                    ByteUtil.nextKey(startKey, currentLength);
                }
{code}

> Use skip scan when row value constructor uses leading row key columns 
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-1211
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1211
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Kyle Buzsaki
>         Attachments: PHOENIX-1211-diff.patch
>
>
> We currently only use a skip scan for a row value constructor equality or in 
> list expression is fully qualified. We can fairly easily use it when only 
> some of the leading pk columns are used.
> For example:
> {code}
> WHERE (a,b) IN ((1,2),(3,4))
> {code}
> If the PK is (a,b,c), we can still use a skip scan. We need to pass through 
> the slotSpan array in this case too, to the SkipScanFilter.



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

Reply via email to