accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1299743 - in /incubator/accumulo/trunk: ./ src/core/src/main/java/org/apache/accumulo/core/iterators/user/ src/core/src/test/java/org/apache/accumulo/core/iterators/user/ src/server/src/main/resources/web/
Date Mon, 12 Mar 2012 17:18:03 GMT
Author: kturner
Date: Mon Mar 12 17:18:02 2012
New Revision: 1299743

URL: http://svn.apache.org/viewvc?rev=1299743&view=rev
Log:
ACCUMULO-403 ACCUMULO-453 merge changes from 1.4

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
    incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
    incubator/accumulo/trunk/src/server/src/main/resources/web/vis.xml

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 12 17:18:02 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873,1245632
 /incubator/accumulo/branches/1.3.5rc:1209938
-/incubator/accumulo/branches/1.4:1201902-1298897
+/incubator/accumulo/branches/1.4:1201902-1299742

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java?rev=1299743&r1=1299742&r2=1299743&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
Mon Mar 12 17:18:02 2012
@@ -49,13 +49,43 @@ import org.apache.hadoop.io.Text;
  */
 public abstract class RowFilter extends WrappingIterator {
   
-  private SortedKeyValueIterator<Key,Value> decisionIterator;
+  private RowIterator decisionIterator;
   private Collection<ByteSequence> columnFamilies;
   Text currentRow;
   private boolean inclusive;
   private Range range;
   private boolean hasTop;
 
+  private static class RowIterator extends WrappingIterator {
+    private Range rowRange;
+    private boolean hasTop;
+    
+    RowIterator(SortedKeyValueIterator<Key,Value> source) {
+      super.setSource(source);
+    }
+    
+    void setRow(Range row) {
+      this.rowRange = row;
+    }
+    
+    @Override
+    public boolean hasTop() {
+      return hasTop && super.hasTop();
+    }
+    
+    @Override
+    public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean
inclusive) throws IOException {
+      
+      range = rowRange.clip(range, true);
+      if (range == null) {
+        hasTop = false;
+      } else {
+        hasTop = true;
+        super.seek(range, columnFamilies, inclusive);
+      }
+    }
+  }
+
   private void skipRows() throws IOException {
     SortedKeyValueIterator<Key,Value> source = getSource();
     while (source.hasTop()) {
@@ -64,7 +94,9 @@ public abstract class RowFilter extends 
       if (currentRow != null && currentRow.equals(row))
         break;
       
-      decisionIterator.seek(new Range(row), columnFamilies, inclusive);
+      Range rowRange = new Range(row);
+      decisionIterator.setRow(rowRange);
+      decisionIterator.seek(rowRange, columnFamilies, inclusive);
       
       if (acceptRow(decisionIterator)) {
         currentRow = row;
@@ -94,7 +126,9 @@ public abstract class RowFilter extends 
    * 
    * 
    * @param rowIterator
-   *          - An iterator over the row.
+   *          - An iterator over the row. This iterator is confined to the row. Seeking past
the end of the row will return no data. Seeking before the row will
+   *          always set top to the first column in the current row. By default this iterator
will only see the columns the parent was seeked with. To see more
+   *          columns reseek this iterator with those columns.
    * @return false if a row should be suppressed, otherwise true.
    * @throws IOException
    */
@@ -103,7 +137,7 @@ public abstract class RowFilter extends 
   @Override
   public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String>
options, IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
-    this.decisionIterator = source.deepCopy(env);
+    this.decisionIterator = new RowIterator(source.deepCopy(env));
   }
   
   @Override

Modified: incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java?rev=1299743&r1=1299742&r2=1299743&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
(original)
+++ incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
Mon Mar 12 17:18:02 2012
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.C
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
@@ -47,13 +48,33 @@ public class RowFilterTest extends TestC
     @Override
     public boolean acceptRow(SortedKeyValueIterator<Key,Value> rowIterator) throws
IOException {
       int sum = 0;
+      int sum2 = 0;
       
+      Key firstKey = null;
+      
+      if (rowIterator.hasTop()) {
+        firstKey = new Key(rowIterator.getTopKey());
+      }
+
       while (rowIterator.hasTop()) {
         sum += Integer.parseInt(rowIterator.getTopValue().toString());
         rowIterator.next();
       }
       
-      return sum == 2;
+      // ensure that seeks are confined to the row
+      rowIterator.seek(new Range(), new HashSet<ByteSequence>(), false);
+      while (rowIterator.hasTop()) {
+        sum2 += Integer.parseInt(rowIterator.getTopValue().toString());
+        rowIterator.next();
+      }
+      
+      rowIterator.seek(new Range(firstKey.getRow(), false, null, true), new HashSet<ByteSequence>(),
false);
+      while (rowIterator.hasTop()) {
+        sum2 += Integer.parseInt(rowIterator.getTopValue().toString());
+        rowIterator.next();
+      }
+      
+      return sum == 2 && sum2 == 2;
     }
     
   }
@@ -110,7 +131,7 @@ public class RowFilterTest extends TestC
 
     IteratorSetting is = new IteratorSetting(40, SummingRowFilter.class);
     conn.tableOperations().attachIterator("table1", is);
-    
+
     Scanner scanner = conn.createScanner("table1", Constants.NO_AUTHS);
     assertEquals(new HashSet<String>(Arrays.asList("2", "3")), getRows(scanner));
     

Modified: incubator/accumulo/trunk/src/server/src/main/resources/web/vis.xml
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/resources/web/vis.xml?rev=1299743&r1=1299742&r2=1299743&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/resources/web/vis.xml (original)
+++ incubator/accumulo/trunk/src/server/src/main/resources/web/vis.xml Mon Mar 12 17:18:02
2012
@@ -76,7 +76,10 @@ window.requestAnimFrame = (function(call
 })();
 
 function handleNewData() {
-  if (xmlhttp.readyState!=4 || xmlhttp.status!=200 || xmlhttp.status==null) {
+  if (xmlhttp.readyState!=4) {
+    return;
+  }
+  if (xmlhttp.status!=200 || xmlhttp.responseXML==null) {
     xmlReturned = true;
     return;
   }



Mime
View raw message