Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/122#discussion_r70259979
  
    --- Diff: 
core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java ---
    @@ -234,20 +234,101 @@ public void test2a() throws IOException {
         a.init(new SortedMapIterator(tm), is.getOptions(), new 
DefaultIteratorEnvironment());
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 902);
    +    assertEquals(902, size(a));
     
         ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a", "b"), 
101l);
         a.init(new SortedMapIterator(tm), is.getOptions(), new 
DefaultIteratorEnvironment());
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 102);
    +    assertEquals(102, size(a));
     
         ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("a", "b"));
         a.init(new SortedMapIterator(tm), is.getOptions(), new 
DefaultIteratorEnvironment());
         a = (ColumnAgeOffFilter) a.deepCopy(null);
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 902);
    +    assertEquals(902, size(a));
    +  }
    +
    +  /**
    +   * Test for fix to ACCUMULO-1604: ColumnAgeOffFilter was throwing an 
error when using negate
    +   */
    +  @Test
    +  public void test2aNegate() throws IOException {
    +    Text colf = new Text("a");
    +    Text colq = new Text("b");
    +    Value dv = new Value();
    +    TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
    +    IteratorSetting is = new IteratorSetting(1, ColumnAgeOffFilter.class);
    +    ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a"), 901l);
    +    ColumnAgeOffFilter.setNegate(is, true);
    +    long ts = System.currentTimeMillis();
    +
    +    for (long i = 0; i < 1000; i++) {
    +      Key k = new Key(new Text(String.format("%03d", i)), colf, colq, ts - 
i);
    +      tm.put(k, dv);
    +    }
    +    assertTrue(tm.size() == 1000);
    --- End diff --
    
    If you'd like, I'd certainly welcome the fix :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to