Search in sources :

Example 41 with SummarizerConfiguration

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());
    }
}
Also used : ByteSequence(org.apache.accumulo.core.data.ByteSequence) Arrays(java.util.Arrays) TableOfflineException(org.apache.accumulo.core.client.TableOfflineException) FileSystem(org.apache.hadoop.fs.FileSystem) Constraint(org.apache.accumulo.core.constraints.Constraint) Text(org.apache.hadoop.io.Text) FileStatus(org.apache.hadoop.fs.FileStatus) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) FindMax(org.apache.accumulo.core.client.admin.FindMax) MasterClientService(org.apache.accumulo.core.master.thrift.MasterClientService) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) Map(java.util.Map) RootTable(org.apache.accumulo.core.metadata.RootTable) Locations(org.apache.accumulo.core.client.admin.Locations) EnumSet(java.util.EnumSet) SamplerConfiguration(org.apache.accumulo.core.client.sample.SamplerConfiguration) Property(org.apache.accumulo.core.conf.Property) Client(org.apache.accumulo.core.client.impl.thrift.ClientService.Client) ThriftNotActiveServiceException(org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException) Set(java.util.Set) TimeType(org.apache.accumulo.core.client.admin.TimeType) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Executors(java.util.concurrent.Executors) VolumeConfiguration(org.apache.accumulo.core.volume.VolumeConfiguration) Tracer(org.apache.accumulo.core.trace.Tracer) CountDownLatch(java.util.concurrent.CountDownLatch) TRowRange(org.apache.accumulo.core.data.thrift.TRowRange) ThriftSecurityException(org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException) ConfigurationCopy(org.apache.accumulo.core.conf.ConfigurationCopy) UtilWaitThread.sleepUninterruptibly(org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly) IsolatedScanner(org.apache.accumulo.core.client.IsolatedScanner) Scanner(org.apache.accumulo.core.client.Scanner) Joiner(com.google.common.base.Joiner) SamplerConfigurationImpl(org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl) HostAndPort(org.apache.accumulo.core.util.HostAndPort) TableExistsException(org.apache.accumulo.core.client.TableExistsException) SummarizerConfigurationUtil(org.apache.accumulo.core.summary.SummarizerConfigurationUtil) SummarizerConfiguration(org.apache.accumulo.core.client.summary.SummarizerConfiguration) SummaryCollection(org.apache.accumulo.core.summary.SummaryCollection) TableDeletedException(org.apache.accumulo.core.client.TableDeletedException) SortedKeyValueIterator(org.apache.accumulo.core.iterators.SortedKeyValueIterator) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MetadataServicer(org.apache.accumulo.core.metadata.MetadataServicer) TableState(org.apache.accumulo.core.master.state.tables.TableState) Key(org.apache.accumulo.core.data.Key) DiskUsage(org.apache.accumulo.core.client.admin.DiskUsage) IteratorUtil(org.apache.accumulo.core.iterators.IteratorUtil) FateOperation(org.apache.accumulo.core.master.thrift.FateOperation) Summary(org.apache.accumulo.core.client.summary.Summary) TSummaryRequest(org.apache.accumulo.core.data.thrift.TSummaryRequest) TException(org.apache.thrift.TException) IOException(java.io.IOException) TabletId(org.apache.accumulo.core.data.TabletId) InputStreamReader(java.io.InputStreamReader) TableOperations(org.apache.accumulo.core.client.admin.TableOperations) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Range(org.apache.accumulo.core.data.Range) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) OpTimer(org.apache.accumulo.core.util.OpTimer) TreeMap(java.util.TreeMap) CachedConfiguration(org.apache.accumulo.core.util.CachedConfiguration) ClientService(org.apache.accumulo.core.client.impl.thrift.ClientService) Preconditions(com.google.common.base.Preconditions) BufferedReader(java.io.BufferedReader) ThriftTableOperationException(org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException) ThriftUtil(org.apache.accumulo.core.rpc.ThriftUtil) SortedSet(java.util.SortedSet) TTransportException(org.apache.thrift.transport.TTransportException) LoggerFactory(org.slf4j.LoggerFactory) Random(java.util.Random) MetadataTable(org.apache.accumulo.core.metadata.MetadataTable) TextUtil(org.apache.accumulo.core.util.TextUtil) ByteBuffer(java.nio.ByteBuffer) TDiskUsage(org.apache.accumulo.core.client.impl.thrift.TDiskUsage) LocalityGroupUtil(org.apache.accumulo.core.util.LocalityGroupUtil) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) NamespaceExistsException(org.apache.accumulo.core.client.NamespaceExistsException) NamingThreadFactory(org.apache.accumulo.core.util.NamingThreadFactory) TabletClientService(org.apache.accumulo.core.tabletserver.thrift.TabletClientService) Path(org.apache.hadoop.fs.Path) Value(org.apache.accumulo.core.data.Value) ZipEntry(java.util.zip.ZipEntry) Collectors.toSet(java.util.stream.Collectors.toSet) Predicate(java.util.function.Predicate) Collection(java.util.Collection) TSummaries(org.apache.accumulo.core.data.thrift.TSummaries) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) IteratorScope(org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope) TabletsSection(org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection) Objects(java.util.Objects) MapCounter(org.apache.accumulo.core.util.MapCounter) List(java.util.List) Pair(org.apache.accumulo.core.util.Pair) Entry(java.util.Map.Entry) Pattern(java.util.regex.Pattern) ZipInputStream(java.util.zip.ZipInputStream) HashMap(java.util.HashMap) CompactionConfig(org.apache.accumulo.core.client.admin.CompactionConfig) TabletLocation(org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation) AtomicReference(java.util.concurrent.atomic.AtomicReference) HashSet(java.util.HashSet) NewTableConfiguration(org.apache.accumulo.core.client.admin.NewTableConfiguration) NotServingTabletException(org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException) Objects.requireNonNull(java.util.Objects.requireNonNull) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) TSummarizerConfiguration(org.apache.accumulo.core.data.thrift.TSummarizerConfiguration) LinkedList(java.util.LinkedList) TApplicationException(org.apache.thrift.TApplicationException) ExecutorService(java.util.concurrent.ExecutorService) Retry(org.apache.accumulo.fate.util.Retry) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) UTF_8(java.nio.charset.StandardCharsets.UTF_8) SummaryRetriever(org.apache.accumulo.core.client.admin.SummaryRetriever) Constants(org.apache.accumulo.core.Constants) Authorizations(org.apache.accumulo.core.security.Authorizations) AccumuloException(org.apache.accumulo.core.client.AccumuloException) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) TimeUnit(java.util.concurrent.TimeUnit) TabletIdImpl(org.apache.accumulo.core.data.impl.TabletIdImpl) Collections(java.util.Collections) SECONDS(java.util.concurrent.TimeUnit.SECONDS) RowIterator(org.apache.accumulo.core.client.RowIterator) ZipEntry(java.util.zip.ZipEntry) Entry(java.util.Map.Entry) SummarizerConfiguration(org.apache.accumulo.core.client.summary.SummarizerConfiguration) TSummarizerConfiguration(org.apache.accumulo.core.data.thrift.TSummarizerConfiguration) HashSet(java.util.HashSet)

Aggregations

SummarizerConfiguration (org.apache.accumulo.core.client.summary.SummarizerConfiguration)41 Test (org.junit.Test)33 HashMap (java.util.HashMap)28 Key (org.apache.accumulo.core.data.Key)22 Value (org.apache.accumulo.core.data.Value)22 Collector (org.apache.accumulo.core.client.summary.Summarizer.Collector)19 EntryLengthSummarizer (org.apache.accumulo.core.client.summary.summarizers.EntryLengthSummarizer)16 Summary (org.apache.accumulo.core.client.summary.Summary)13 NewTableConfiguration (org.apache.accumulo.core.client.admin.NewTableConfiguration)10 CounterSummary (org.apache.accumulo.core.client.summary.CounterSummary)10 Connector (org.apache.accumulo.core.client.Connector)9 BatchWriter (org.apache.accumulo.core.client.BatchWriter)8 Text (org.apache.hadoop.io.Text)8 FamilySummarizer (org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer)7 ArrayList (java.util.ArrayList)6 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)6 IOException (java.io.IOException)5 Collection (java.util.Collection)5 Map (java.util.Map)5 Entry (java.util.Map.Entry)5