use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class TableOperationsImpl method addSummarizers.
@Override
public void addSummarizers(String tableName, SummarizerConfiguration... newConfigs) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
HashSet<SummarizerConfiguration> currentConfigs = new HashSet<>(SummarizerConfiguration.fromTableProperties(getProperties(tableName)));
HashSet<SummarizerConfiguration> newConfigSet = new HashSet<>(Arrays.asList(newConfigs));
newConfigSet.removeIf(sc -> currentConfigs.contains(sc));
Set<String> newIds = newConfigSet.stream().map(sc -> sc.getPropertyId()).collect(toSet());
for (SummarizerConfiguration csc : currentConfigs) {
if (newIds.contains(csc.getPropertyId())) {
throw new IllegalArgumentException("Summarizer property id is in use by " + csc);
}
}
Set<Entry<String, String>> es = SummarizerConfiguration.toTableProperties(newConfigSet).entrySet();
for (Entry<String, String> entry : es) {
setProperty(tableName, entry.getKey(), entry.getValue());
}
}
Aggregations