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

James Taylor edited comment on PHOENIX-1027 at 6/7/14 7:42 AM:
---------------------------------------------------------------

I see - can you repro this with a unit test? The skip scan does not maintain 
much state - you just have to capture the row key before the error and the 
transition being done to repro it. See SkipScanFilterTest.

The code to which you're referring is incrementing the position of a slot but 
potentially wrapping it back to 0 if necessary.


was (Author: jamestaylor):
I see - can you repro this with a unit test? The skip scan does not maintain 
much state - you just have to capture the row key before the error and the 
transition being done to repro it. See SkipScanFilterTest.

> Why position be reset in SkipScanFilter
> ---------------------------------------
>
>                 Key: PHOENIX-1027
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1027
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: jay wong
>
> the method in SkipScanFilter.java
> {code}
>  private int nextPosition(int i) {
>         while (i >= 0 && slots.get(i).get(position[i]).isSingleKey() && 
> (position[i] = (position[i] + 1) % slots.get(i).size()) == 0) {
>             i--;
>         }
>         return i;
>     }
> {code}
> In a query case. position[] has two elements position[0] = 3, position[1] = 
> 0. 
> and slots.get( i ).size() = 1. 
> after the mothod execute two element in position[] are all 0.
> then
> {code}
>  private boolean intersect(byte[] lowerInclusiveKey, byte[] 
> upperExclusiveKey, List<List<KeyRange>> newSlots) {
> ........
>  for (int i = 0; i <= lastSlot; i++) {
>             List<KeyRange> newRanges = slots.get(i).subList(lowerPosition[i], 
> Math.min(position[i] + 1, slots.get(i).size()));
>             .....
>         }
>         return true;
>     }
> {code}
> lowerPosition[i] = 3, Math.min(position[i] + 1, 
> slots.get( i ).size()) = 0 as a result of position[i] = 0
> so:
> {code}
> java.lang.IndexOutOfBoundsException: end index (1) must not be less than 
> start index (3)
> at 
> com.google.common.base.Preconditions.checkPositionIndexes(Preconditions.java:384)
> at 
> com.google.common.collect.RegularImmutableList.subList(RegularImmutableList.java:118)
> at 
> com.google.common.collect.RegularImmutableList.subList(RegularImmutableList.java:31)
> at org.apache.phoenix.filter.SkipScanFilter.intersect(SkipScanFilter.java:221)
> at 
> org.apache.phoenix.filter.SkipScanFilter.hasIntersect(SkipScanFilter.java:121)
> at org.apache.phoenix.compile.ScanRanges.intersect(ScanRanges.java:251)
> at 
> org.apache.phoenix.iterate.SkipRangeParallelIteratorRegionSplitter$1.apply(SkipRangeParallelIteratorRegionSplitter.java:84)
> at 
> org.apache.phoenix.iterate.SkipRangeParallelIteratorRegionSplitter$1.apply(SkipRangeParallelIteratorRegionSplitter.java:65)
> at com.google.common.collect.Iterators$7.computeNext(Iterators.java:649)
> at 
> com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
> at 
> com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
> at com.google.common.collect.Lists.newArrayList(Lists.java:138)
> at com.google.common.collect.Lists.newArrayList(Lists.java:119)
> at 
> org.apache.phoenix.iterate.SkipRangeParallelIteratorRegionSplitter.filterRegions(SkipRangeParallelIteratorRegionSplitter.java:93)
> at 
> org.apache.phoenix.iterate.SkipRangeParallelIteratorRegionSplitter.getAllRegions(SkipRangeParallelIteratorRegionSplitter.java:54)
> at 
> org.apache.phoenix.iterate.DefaultParallelIteratorRegionSplitter.getSplits(DefaultParallelIteratorRegionSplitter.java:244)
> at 
> org.apache.phoenix.iterate.ParallelIterators.getSplits(ParallelIterators.java:205)
> at 
> org.apache.phoenix.iterate.ParallelIterators.<init>(ParallelIterators.java:78)
> at 
> org.apache.phoenix.execute.AggregatePlan.newIterator(AggregatePlan.java:162)
> at org.apache.phoenix.execute.BasicQueryPlan.iterator(BasicQueryPlan.java:144)
> at org.apache.phoenix.execute.BasicQueryPlan.iterator(BasicQueryPlan.java:125)
> at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:202)
> at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:922)
> at sqlline.SqlLine$Commands.execute(SqlLine.java:3673)
> at sqlline.SqlLine$Commands.sql(SqlLine.java:3584)
> at sqlline.SqlLine.dispatch(SqlLine.java:821)
> at sqlline.SqlLine.begin(SqlLine.java:699)
> at sqlline.SqlLine.mainWithInputRedirection(SqlLine.java:441)
> at sqlline.SqlLine.main(SqlLine.java:424)
> {code}



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

Reply via email to