private void init(SummarizerConfiguration conf) { maxCounters = Integer .parseInt(conf.getOptions().getOrDefault(MAX_COUNTERS_OPT, MAX_COUNTER_DEFAULT)); maxCounterKeyLen = Integer .parseInt(conf.getOptions().getOrDefault(MAX_COUNTER_LEN_OPT, MAX_CKL_DEFAULT)); ignoreDeletes = Boolean .parseBoolean(conf.getOptions().getOrDefault(INGNORE_DELETES_OPT, INGNORE_DELETES_DEFAULT)); }
public void writeConfig(SummarizerConfiguration conf, DataOutputStream dos) throws IOException { // save class (and its config) used to generate summaries dos.writeUTF(conf.getClassName()); dos.writeUTF(conf.getPropertyId()); WritableUtils.writeVInt(dos, conf.getOptions().size()); for (Entry<String,String> entry : conf.getOptions().entrySet()) { dos.writeUTF(entry.getKey()); dos.writeUTF(entry.getValue()); } }
public static Map<String,String> toTablePropertiesMap(List<SummarizerConfiguration> summarizers) { if (summarizers.size() == 0) { return Collections.emptyMap(); } Map<String,String> props = new HashMap<>(); for (SummarizerConfiguration sconf : summarizers) { String cid = sconf.getPropertyId(); String prefix = Property.TABLE_SUMMARIZER_PREFIX.getKey() + cid; if (props.containsKey(prefix)) { throw new IllegalArgumentException("Duplicate summarizer config id : " + cid); } props.put(prefix, sconf.getClassName()); Set<Entry<String,String>> es = sconf.getOptions().entrySet(); StringBuilder sb = new StringBuilder(prefix + ".opt."); int resetLen = sb.length(); for (Entry<String,String> entry : es) { sb.append(entry.getKey()); props.put(sb.toString(), entry.getValue()); sb.setLength(resetLen); } } return props; }
public Gatherer(ClientContext context, TSummaryRequest request, AccumuloConfiguration tableConfig, CryptoService cryptoService) { this.ctx = context; this.tableId = Table.ID.of(request.tableId); this.startRow = ByteBufferUtil.toText(request.bounds.startRow); this.endRow = ByteBufferUtil.toText(request.bounds.endRow); this.clipRange = new Range(startRow, false, endRow, true); this.summaries = request.getSummarizers().stream().map(SummarizerConfigurationUtil::fromThrift) .collect(Collectors.toSet()); this.request = request; this.cryptoService = cryptoService; this.summarizerPattern = request.getSummarizerPattern(); if (summarizerPattern != null) { Pattern pattern = Pattern.compile(summarizerPattern); // The way conf is converted to string below is documented in the API, so consider this when // making changes! summarySelector = conf -> pattern .matcher(conf.getClassName() + " " + new TreeMap<>(conf.getOptions())).matches(); if (!summaries.isEmpty()) { summarySelector = summarySelector.or(conf -> summaries.contains(conf)); } } else if (!summaries.isEmpty()) { summarySelector = conf -> summaries.contains(conf); } else { summarySelector = conf -> true; } this.factory = new SummarizerFactory(tableConfig); }
public static TSummarizerConfiguration toThrift(SummarizerConfiguration sc) { return new TSummarizerConfiguration(sc.getClassName(), sc.getOptions(), sc.getPropertyId()); }
.equals(DeletesSummarizer.class.getName()) && conf.getOptions().isEmpty();