Examples of LargeRowFilter


Examples of org.apache.accumulo.core.iterators.LargeRowFilter

    }
  }
 
  private LargeRowFilter setupIterator(TreeMap<Key,Value> testData, int maxColumns, IteratorScope scope) throws IOException {
    SortedMapIterator smi = new SortedMapIterator(testData);
    LargeRowFilter lrfi = new LargeRowFilter();
    HashMap<String,String> options = new HashMap<String,String>();
    options.put(LargeRowFilter.MAX_COLUMNS, "" + maxColumns);
    lrfi.init(new ColumnFamilySkippingIterator(smi), options, new RowDeletingIteratorTest.TestIE(scope, false));
    return lrfi;
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.LargeRowFilter

   
    for (int i = 1; i <= 20; i++) {
      TreeMap<Key,Value> expectedData = new TreeMap<Key,Value>();
      genTestData(expectedData, i);
     
      LargeRowFilter lrfi = setupIterator(testData, i, IteratorScope.scan);
      lrfi.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
     
      TreeMap<Key,Value> filteredData = new TreeMap<Key,Value>();
     
      while (lrfi.hasTop()) {
        filteredData.put(lrfi.getTopKey(), lrfi.getTopValue());
        lrfi.next();
      }
     
      assertEquals(expectedData, filteredData);
    }
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.LargeRowFilter

   
    for (int i = 1; i <= 20; i++) {
      TreeMap<Key,Value> expectedData = new TreeMap<Key,Value>();
      genTestData(expectedData, i);
     
      LargeRowFilter lrfi = setupIterator(testData, i, IteratorScope.scan);
     
      TreeMap<Key,Value> filteredData = new TreeMap<Key,Value>();
     
      // seek to each row... rows that exceed max columns should be filtered
      for (int j = 1; j <= i; j++) {
        lrfi.seek(new Range(genRow(j), genRow(j)), LocalityGroupUtil.EMPTY_CF_SET, false);
       
        while (lrfi.hasTop()) {
          assertEquals(genRow(j), lrfi.getTopKey().getRow().toString());
          filteredData.put(lrfi.getTopKey(), lrfi.getTopValue());
          lrfi.next();
        }
      }
     
      assertEquals(expectedData, filteredData);
    }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.LargeRowFilter

  public void testSeek2() throws Exception {
    TreeMap<Key,Value> testData = new TreeMap<Key,Value>();
   
    genTestData(testData, 20);
   
    LargeRowFilter lrfi = setupIterator(testData, 13, IteratorScope.scan);
   
    // test seeking to the middle of a row
    lrfi.seek(new Range(new Key(genRow(15), "cf001", genCQ(4), 5), true, new Key(genRow(15)).followingKey(PartialKey.ROW), false),
        LocalityGroupUtil.EMPTY_CF_SET, false);
    assertFalse(lrfi.hasTop());
   
    lrfi.seek(new Range(new Key(genRow(10), "cf001", genCQ(4), 5), true, new Key(genRow(10)).followingKey(PartialKey.ROW), false),
        LocalityGroupUtil.EMPTY_CF_SET, false);
    TreeMap<Key,Value> expectedData = new TreeMap<Key,Value>();
    genRow(expectedData, 10, 4, 10);
   
    TreeMap<Key,Value> filteredData = new TreeMap<Key,Value>();
    while (lrfi.hasTop()) {
      filteredData.put(lrfi.getTopKey(), lrfi.getTopValue());
      lrfi.next();
    }
   
    assertEquals(expectedData, filteredData);
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.LargeRowFilter

  public void testCompaction() throws Exception {
    TreeMap<Key,Value> testData = new TreeMap<Key,Value>();
   
    genTestData(testData, 20);
   
    LargeRowFilter lrfi = setupIterator(testData, 13, IteratorScope.majc);
    lrfi.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
   
    TreeMap<Key,Value> compactedData = new TreeMap<Key,Value>();
    while (lrfi.hasTop()) {
      compactedData.put(lrfi.getTopKey(), lrfi.getTopValue());
      lrfi.next();
    }
   
    // compacted data should now contain suppression markers
    // add column to row that should be suppressed\
    genRow(compactedData, 15, 15, 16);
   
    // scanning over data w/ higher max columns should not change behavior
    // because there are suppression markers.. if there was a bug and data
    // was not suppressed, increasing the threshold would expose the bug
    lrfi = setupIterator(compactedData, 20, IteratorScope.scan);
    lrfi.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
   
    // only expect to see 13 rows
    TreeMap<Key,Value> expectedData = new TreeMap<Key,Value>();
    genTestData(expectedData, 13);
   
    TreeMap<Key,Value> filteredData = new TreeMap<Key,Value>();
    while (lrfi.hasTop()) {
      filteredData.put(lrfi.getTopKey(), lrfi.getTopValue());
      lrfi.next();
    }
   
    assertEquals(expectedData.size() + 8, compactedData.size());
    assertEquals(expectedData, filteredData);
   
    // try seeking to the middle of row 15... row has data and suppression marker... this seeks past the marker but before the column
    lrfi.seek(new Range(new Key(genRow(15), "cf001", genCQ(4), 5), true, new Key(genRow(15)).followingKey(PartialKey.ROW), false),
        LocalityGroupUtil.EMPTY_CF_SET, false);
    assertFalse(lrfi.hasTop());
   
    // test seeking w/ column families
    HashSet<ByteSequence> colfams = new HashSet<ByteSequence>();
    colfams.add(new ArrayByteSequence("cf001"));
    lrfi.seek(new Range(new Key(genRow(15), "cf001", genCQ(4), 5), true, new Key(genRow(15)).followingKey(PartialKey.ROW), false), colfams, true);
    assertFalse(lrfi.hasTop());
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.LargeRowFilter

   
    TreeMap<Key,Value> expectedData = new TreeMap<Key,Value>();
    genRow(expectedData, 1, 0, 2);
    genRow(expectedData, 4, 0, 5);
   
    LargeRowFilter lrfi = setupIterator(testData, 13, IteratorScope.scan);
    lrfi.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
   
    TreeMap<Key,Value> filteredData = new TreeMap<Key,Value>();
    while (lrfi.hasTop()) {
      filteredData.put(lrfi.getTopKey(), lrfi.getTopValue());
      lrfi.next();
    }
   
    assertEquals(expectedData, filteredData);
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.