milleruntime commented on issue #1388: API for loading iterators from config
URL: https://github.com/apache/accumulo/issues/1388#issuecomment-598282738
 
 
   Looking for feedback about this issue... I found one use case for an API for 
this method 
[here](https://github.com/NationalSecurityAgency/datawave/blob/7e9f0c68275361cb57d5a82ddd874101c1867528/warehouse/query-core/src/main/java/datawave/mr/bulk/RecordIterator.java#L390).
   
   One idea I had was to put this method onto the ```TableOperations``` 
interface.  It could look like this:
   ```
   /**
      * Load a stack of iterators from what is configured on the provided table 
and with the scope.
      * The specified source will be the bottom of the stack and the top 
SortedKeyValueIterator on the
      * stack will be returned.  The objects would be created and have their 
init methods called.
      *
      * @param tableName
      *          the name of the table where the iterators are configured
      * @param scope
      *          the scope of the iterators
      * @param source
      *          the iterator at the start of the stack
      * @return the SortedKeyValueIterator at the top of the stack
      */
     SortedKeyValueIterator<Key,Value> loadIterators(String tableName, 
IteratorScope scope,
         SortedKeyValueIterator<Key,Value> source)
         throws AccumuloException, TableNotFoundException, IOException;
   ```
   
   This would be very similar to the internal method.  Loading the iterators 
this way can't guarantee any order that they are applied to the stack though.  
Another way would be to just return a list of ```IteratorSetting``` objects but 
this is basically what 
[TableOperations.listIterators](https://github.com/apache/accumulo/blob/master/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java#L942)
 currently does.
   
   We could also just supply a convenience static method on ```IteratorUtil``` 
now that is part of the public API, like this:
   ```
   public static SortedKeyValueIterator<Key,Value> loadIterators(AccumuloClient 
client, String tableName, IteratorScope scope, 
SortedKeyValueIterator<Key,Value> source)
   ```
   
   I am not convinced we need a public method for this behavor but I thought it 
should be addressed in 2.1.  We would basically be providing what is done 
internally 
[here](https://github.com/apache/accumulo/blob/3fd5cad92f9b63ac19e4466f3f2d5237b905262c/core/src/main/java/org/apache/accumulo/core/conf/IterConfigUtil.java#L202).
  We would need an option whether to initialize the iterators or not.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to