private Collection<Mutation> getMetricsMutations() { ImmutableList.Builder<Mutation> mutationBuilder = ImmutableList.builder(); // Mapping of column value to column to number of row IDs that contain that value for (Entry<MetricsKey, AtomicLong> entry : metrics.entrySet()) { // Row ID: Column value // Family: columnfamily_columnqualifier // Qualifier: CARDINALITY_CQ // Visibility: Inherited from indexed Mutation // Value: Cardinality Mutation mut = new Mutation(entry.getKey().row.array()); mut.put(entry.getKey().family.array(), CARDINALITY_CQ, entry.getKey().visibility, ENCODER.encode(entry.getValue().get())); // Add to our list of mutations mutationBuilder.add(mut); } // If the first row and last row are both not null, // which would really be for a brand new table that has zero rows and no indexed elements... // Talk about your edge cases! if (firstRow != null && lastRow != null) { // Add a some columns to the special metrics table row ID for the first/last row. // Note that if the values on the server side are greater/lesser, // the configured iterator will take care of this at scan/compaction time Mutation firstLastMutation = new Mutation(METRICS_TABLE_ROW_ID.array()); firstLastMutation.put(METRICS_TABLE_ROWS_CF.array(), METRICS_TABLE_FIRST_ROW_CQ.array(), firstRow); firstLastMutation.put(METRICS_TABLE_ROWS_CF.array(), METRICS_TABLE_LAST_ROW_CQ.array(), lastRow); mutationBuilder.add(firstLastMutation); } return mutationBuilder.build(); }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.addNamedOption(TTL, "time to live (milliseconds)"); io.addNamedOption(CURRENT_TIME, "if set, use the given value as the" + " absolute time in milliseconds as the current time of day"); io.setName("ageoff"); io.setDescription( "AgeOffFilter removes entries with timestamps more than <ttl> milliseconds old"); return io; }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("longcombiner"); io.setDescription("LongCombiner can interpret Values as Longs in a variety of encodings" + " (variable length, fixed length, or string) before combining"); io.addNamedOption(TYPE, "<VARLEN|FIXEDLEN|STRING|fullClassName>"); return io; }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("colageoff"); io.setDescription("ColumnAgeOffFilter ages off columns at different rates" + " given a time to live in milliseconds for each column"); io.addUnnamedOption("<col fam>[:<col qual>] <Long> (escape non-alphanum chars using %<hex>)"); return io; }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("bigdecimalcombiner"); io.setDescription("bigdecimalcombiner interprets Values as BigDecimals before combining"); return io; }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("max"); io.setDescription("MaxCombiner interprets Values as Longs and finds their" + " maximum. A variety of encodings (variable length, fixed length, or" + " string) are available"); return io; } }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.addNamedOption(LOSSY, "if true, failed decodes are ignored. Otherwise" + " combiner will error on failed decodes (default false): <TRUE|FALSE>"); return io; }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setLossyness(options); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(options); }
@SuppressWarnings("unchecked") @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TypedValueCombiner<V> newInstance = (TypedValueCombiner<V>) super.deepCopy(env); newInstance.setEncoder(encoder); return newInstance; }