accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1354671 - /accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
Date Wed, 27 Jun 2012 19:08:36 GMT
Author: ecn
Date: Wed Jun 27 19:08:35 2012
New Revision: 1354671

URL: http://svn.apache.org/viewvc?rev=1354671&view=rev
Log:
ACCUMULO-17

Modified:
    accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java

Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java?rev=1354671&r1=1354670&r2=1354671&view=diff
==============================================================================
--- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
(original)
+++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
Wed Jun 27 19:08:35 2012
@@ -31,6 +31,7 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.commons.collections.iterators.IteratorChain;
 
 public class MockBatchScanner extends MockScannerBase implements BatchScanner {
   
@@ -67,20 +68,25 @@ public class MockBatchScanner extends Mo
     }
   }
   
+  @SuppressWarnings("unchecked")
   @Override
   public Iterator<Entry<Key,Value>> iterator() {
     if (ranges == null) {
       throw new IllegalStateException("ranges not set");
     }
 
-    SortedKeyValueIterator<Key,Value> i = new SortedMapIterator(table.table);
-    try {
-      i = new RangesFilter(createFilter(i), ranges);
-      i.seek(new Range(), createColumnBSS(fetchedColumns), !fetchedColumns.isEmpty());
-      return new IteratorAdapter(i);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
+    IteratorChain chain = new IteratorChain();
+    for (Range range : ranges) {
+      SortedKeyValueIterator<Key,Value> i = new SortedMapIterator(table.table);
+      try {
+        i = new RangesFilter(createFilter(i), ranges);
+        i.seek(range, createColumnBSS(fetchedColumns), !fetchedColumns.isEmpty());
+        chain.addIterator(new IteratorAdapter(i));
+      } catch (IOException e) {
+        throw new RuntimeException(e);
+      }
     }
+    return chain;
   }
   
   @Override



Mime
View raw message