keith-turner commented on code in PR #5490:
URL: https://github.com/apache/accumulo/pull/5490#discussion_r2058547999


##########
server/base/src/main/java/org/apache/accumulo/server/iterators/TabletIteratorEnvironment.java:
##########
@@ -79,6 +80,30 @@ public TabletIteratorEnvironment(ServerContext context, 
IteratorScope scope,
     this.topLevelIterators = new ArrayList<>();
   }
 
+  public TabletIteratorEnvironment(ServerContext context, IteratorScope scope,

Review Comment:
   I experimented w/ using the new code in InMemoryMapTest to create an iterenv 
and it worked really nicely and the test passed.   The new class is a good 
general purpose builder for an IteratorEnv, seems fine to me to use it in the 
server code and remove this new constructor.
   
   ```java
         IteratorEnvironment iterEnv =
             new 
ClientIteratorEnvironment.Builder().withClient(getServerContext())
                 
.withScope(IteratorScope.scan).withTableId(TableId.of("foo")).build();
         IteratorEnvironment iterEnvSC =
             new 
ClientIteratorEnvironment.Builder().withClient(getServerContext())
                 
.withScope(IteratorScope.scan).withTableId(TableId.of("foo")).withSamplingEnabled()
                 
.withSamplerConfiguration(sampleConfig.toSamplerConfiguration()).build();
         SortedKeyValueIterator<Key,Value> iter0dc1 = iter0.deepCopy(iterEnv);
         SortedKeyValueIterator<Key,Value> iter0dc2 = iter0.deepCopy(iterEnvSC);
         SortedKeyValueIterator<Key,Value> iter1dc1 = iter1.deepCopy(iterEnv);
         SortedKeyValueIterator<Key,Value> iter1dc2 = iter1.deepCopy(iterEnvSC);
         SortedKeyValueIterator<Key,Value> iter2dc1 = iter2.deepCopy(iterEnv);
         SortedKeyValueIterator<Key,Value> iter2dc2 = iter2.deepCopy(iterEnvSC);
   ```
   
   Not a change for this PR, but maybe in the public API I  we cold eventually 
add a static `builder()` method to `IteratorEnvironment` and use this new code 
as the impl.   Then could write the above code like the following.
   
   ```java
         IteratorEnvironment iterEnv =
             IteratorEnvironment.builder().withClient(getServerContext())
                 
.withScope(IteratorScope.scan).withTableId(TableId.of("foo")).build();
   ```
   
   In this PR would could add a static `builder()` method to 
ClientIteratorEnvironment. Would make the code that uses the builder slightly 
shorter. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to