Author: billie Date: Fri Jun 15 20:33:43 2012 New Revision: 1350786 URL: http://svn.apache.org/viewvc?rev=1350786&view=rev Log: ACCUMULO-633 created test and fixed seek behavior of FirstEntryInRowIterator - merged to 1.4.1 branch
Added: accumulo/branches/1.4.1/src/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java - copied unchanged from r1349972, accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java Modified: accumulo/branches/1.4.1/ (props changed) accumulo/branches/1.4.1/src/ (props changed) accumulo/branches/1.4.1/src/core/ (props changed) accumulo/branches/1.4.1/src/core/src/main/java/org/apache/accumulo/core/iterators/FirstEntryInRowIterator.java accumulo/branches/1.4.1/src/server/ (props changed) Propchange: accumulo/branches/1.4.1/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.3:r1349971 Merged /accumulo/branches/1.4:r1349972 Propchange: accumulo/branches/1.4.1/src/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.4/src:r1349972 Merged /accumulo/branches/1.3/src:r1349971 Propchange: accumulo/branches/1.4.1/src/core/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.3/src/core:r1349971 Merged /accumulo/branches/1.4/src/core:r1349972 Modified: accumulo/branches/1.4.1/src/core/src/main/java/org/apache/accumulo/core/iterators/FirstEntryInRowIterator.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4.1/src/core/src/main/java/org/apache/accumulo/core/iterators/FirstEntryInRowIterator.java?rev=1350786&r1=1350785&r2=1350786&view=diff ============================================================================== --- accumulo/branches/1.4.1/src/core/src/main/java/org/apache/accumulo/core/iterators/FirstEntryInRowIterator.java (original) +++ accumulo/branches/1.4.1/src/core/src/main/java/org/apache/accumulo/core/iterators/FirstEntryInRowIterator.java Fri Jun 15 20:33:43 2012 @@ -86,6 +86,8 @@ public class FirstEntryInRowIterator ext // this is only ever called immediately after getting "next" entry @Override protected void consume() throws IOException { + if (lastRowFound == null) + return; int count = 0; while (getSource().hasTop() && lastRowFound.equals(getSource().getTopKey().getRow())) { @@ -112,10 +114,17 @@ public class FirstEntryInRowIterator ext latestRange = range; latestColumnFamilies = columnFamilies; latestInclusive = inclusive; + lastRowFound = null; - // seek to first possible pattern in range - super.seek(range, columnFamilies, inclusive); - lastRowFound = getSource().hasTop() ? getSource().getTopKey().getRow() : null; + Key startKey = range.getStartKey(); + Range seekRange = new Range(startKey == null ? null : new Key(startKey.getRow()), true, range.getEndKey(), range.isEndKeyInclusive()); + super.seek(seekRange, columnFamilies, inclusive); + + if (getSource().hasTop()) { + lastRowFound = getSource().getTopKey().getRow(); + if (range.beforeStartKey(getSource().getTopKey())) + consume(); + } } @Override Propchange: accumulo/branches/1.4.1/src/server/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.3/src/server:r1349971 Merged /accumulo/branches/1.4/src/server:r1349972