@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(options); }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("bigdecimalcombiner"); io.setDescription("bigdecimalcombiner interprets Values as BigDecimals before combining"); return io; }
@Override public boolean validateOptions(Map<String,String> options) { return super.validateOptions(options); }
@Override public boolean validateOptions(Map<String,String> options) { if (!super.validateOptions(options)) return false; try { setLossyness(options); } catch (Exception e) { throw new IllegalArgumentException("bad boolean " + LOSSY + ":" + options.get(LOSSY)); } return true; }
@SuppressWarnings("unchecked") @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TypedValueCombiner<V> newInstance = (TypedValueCombiner<V>) super.deepCopy(env); newInstance.setEncoder(encoder); return newInstance; }
@Override public Value reduce(Key key, Iterator<Value> iter) { return new Value(encoder.encode(typedReduce(key, new VIterator<>(iter, encoder, lossy)))); }
/** * Tests whether v remains the same when encoded and decoded with the current encoder. * * @throws IllegalStateException * if an encoder has not been set. * @throws IllegalArgumentException * if the test fails. */ protected void testEncoder(V v) { if (encoder == null) throw new IllegalStateException("encoder has not been initialized"); testEncoder(encoder, v); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setLossyness(options); }
@SuppressWarnings("unchecked") @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TypedValueCombiner<V> newInstance = (TypedValueCombiner<V>) super.deepCopy(env); newInstance.setEncoder(encoder); return newInstance; }
@Override public Value reduce(Key key, Iterator<Value> iter) { return new Value(encoder.encode(typedReduce(key, new VIterator<>(iter, encoder, lossy)))); }
/** * Tests whether v remains the same when encoded and decoded with the current encoder. * * @throws IllegalStateException * if an encoder has not been set. * @throws IllegalArgumentException * if the test fails. */ protected void testEncoder(V v) { if (encoder == null) throw new IllegalStateException("encoder has not been initialized"); testEncoder(encoder, v); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(BDE); }
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("StatusCombiner"); io.setDescription( "Combiner that joins multiple Status protobufs to track replication metadata"); return io; }
@Override public boolean validateOptions(Map<String,String> options) { return super.validateOptions(options); }
@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); }
@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 boolean validateOptions(Map<String,String> options) { if (!super.validateOptions(options)) return false; try { setEncoder(options); } catch (Exception e) { throw new IllegalArgumentException("bad encoder option", e); } return true; }
@Override public boolean validateOptions(Map<String,String> options) { if (super.validateOptions(options) == false) return false; try { setLossyness(options); } catch (Exception e) { throw new IllegalArgumentException("bad boolean " + LOSSY + ":" + options.get(LOSSY)); } return true; }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(new StatusEncoder()); }