Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-2501

Add deepCopy to RowFilter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.1, 1.6.0
    • 1.5.2, 1.6.1, 1.7.0
    • None

    Description

      It would be nice for subclasses of RowFilter to be chainable, for this they need to provide an implementation of deepCopy. Adding a base implementation in RowFilter would make things easier.

      Here's a patch (taken from git commit 23980d3)... please let me know if I'm missing something, maybe there's more to it than I can see?

      diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
      index a232796..ad1e4a0 100644
      --- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
      +++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
      @@ -139,7 +139,20 @@ public abstract class RowFilter extends WrappingIterator {
           super.init(source, options, env);
           this.decisionIterator = new RowIterator(source.deepCopy(env));
         }
      -  
      +
      +  @Override
      +  public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
      +      RowFilter newInstance;
      +      try {
      +          newInstance = getClass().newInstance();
      +      } catch (Exception e) {
      +          throw new RuntimeException(e);
      +      }
      +      newInstance.setSource(getSource().deepCopy(env));
      +      newInstance.decisionIterator = new RowIterator(getSource().deepCopy(env));
      +      return newInstance;
      +  }
      +
         @Override
         public boolean hasTop() {
           return hasTop && super.hasTop();
      

      Attachments

        1. ACCUMULO-2501.patch
          7 kB
          Russ Weeks

        Activity

          People

            rweeks Russ Weeks
            rweeks Russ Weeks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h