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

    https://github.com/apache/accumulo/pull/224#discussion_r103725643
  
    --- Diff: 
core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
 ---
    @@ -1661,4 +1676,138 @@ public Locations locate(String tableName, 
Collection<Range> ranges) throws Accum
     
         return new LoctionsImpl(binnedRanges);
       }
    +
    +  @Override
    +  public SummaryRetriever getSummaries(String tableName) {
    +
    +    return new SummaryRetriever() {
    +
    +      private Text startRow = null;
    +      private Text endRow = null;
    +      private List<TSummarizerConfiguration> summariesToFetch = 
Collections.emptyList();
    +      private String summarizerClassRegex;
    +      private boolean flush = false;
    +
    +      @Override
    +      public SummaryRetriever startRow(Text startRow) {
    +        Objects.requireNonNull(startRow);
    +        if (endRow != null) {
    +          Preconditions.checkArgument(startRow.compareTo(endRow) < 0, 
"Start row must be less than end row : %s >= %s", startRow, endRow);
    +        }
    +        this.startRow = startRow;
    +        return this;
    +      }
    +
    +      @Override
    +      public SummaryRetriever startRow(CharSequence startRow) {
    +        return startRow(new Text(startRow.toString()));
    +      }
    +
    +      @Override
    +      public List<Summary> retrieve() throws AccumuloException, 
AccumuloSecurityException, TableNotFoundException {
    +        String tableId = Tables.getTableId(context.getInstance(), 
tableName);
    +        if (Tables.getTableState(context.getInstance(), tableId) == 
TableState.OFFLINE)
    +          throw new TableOfflineException(context.getInstance(), tableId);
    +
    +        TRowRange range = new TRowRange(TextUtil.getByteBuffer(startRow), 
TextUtil.getByteBuffer(endRow));
    +        TSummaryRequest request = new TSummaryRequest(tableId, range, 
summariesToFetch, summarizerClassRegex);
    +        if (flush) {
    +          _flush(tableId, startRow, endRow, true);
    +        }
    +
    +        ClientContext cct = new ClientContext(context.getInstance(), 
context.getCredentials(), context.getConfiguration()) {
    +          @Override
    +          public long getClientTimeoutInMillis() {
    +            return Math.max(super.getClientTimeoutInMillis(), 60 * 60 * 
1000);
    +          }
    +        };
    +        TSummaries ret = ServerClient.execute(cct, c -> 
c.getSummaries(Tracer.traceInfo(), context.rpcCreds(), request));
    +        return new SummaryCollection(ret).getSummaries();
    +      }
    +
    +      @Override
    +      public SummaryRetriever endRow(Text endRow) {
    +        Objects.requireNonNull(endRow);
    +        if (startRow != null) {
    +          Preconditions.checkArgument(startRow.compareTo(endRow) < 0, 
"Start row must be less than end row : %s >= %s", startRow, endRow);
    +        }
    +        this.endRow = endRow;
    +        return this;
    +      }
    +
    +      @Override
    +      public SummaryRetriever endRow(CharSequence endRow) {
    +        return endRow(new Text(endRow.toString()));
    +      }
    +
    +      @Override
    +      public SummaryRetriever 
withConfiguration(Collection<SummarizerConfiguration> configs) {
    +        Objects.requireNonNull(configs);
    +        summariesToFetch = 
configs.stream().map(SummarizerConfigurationUtil::toThrift).collect(Collectors.toList());
    +        return this;
    +      }
    +
    +      @Override
    +      public SummaryRetriever withConfiguration(SummarizerConfiguration... 
config) {
    +        Objects.requireNonNull(config);
    +        return withConfiguration(Arrays.asList(config));
    +      }
    +
    +      @Override
    +      public SummaryRetriever withMatchingConfiguration(String regex) {
    +        Objects.requireNonNull(regex);
    +        // Do a sanity check here to make sure that regex compiles, 
instead of having it fail on a tserver.
    +        Pattern.compile(regex);
    +        this.summarizerClassRegex = regex;
    +        return this;
    +      }
    +
    +      @Override
    +      public SummaryRetriever flush(boolean b) {
    +        this.flush = b;
    +        return this;
    +      }
    +    };
    +  }
    +
    +  @Override
    +  public void addSummarizers(String tableName, SummarizerConfiguration... 
newConfigs) throws AccumuloException, AccumuloSecurityException,
    +      TableNotFoundException {
    +    HashSet<SummarizerConfiguration> currentConfigs = new 
HashSet<>(SummarizerConfiguration.fromTableProperties(getProperties(tableName)));
    --- End diff --
    
    `Collections.singleton` instead of `new HashSet<>`?


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