@Override public void collect(byte[] key, byte[] value) throws IOException { if (!MINIMIZE_ALLOCATIONS || keyBB == null || keyBB.capacity() < key.length) { keyBB = ByteBuffer.wrap(key); } else { keyBB.position(0); keyBB.limit(key.length); keyBB.put(key); keyBB.position(0); } if (!MINIMIZE_ALLOCATIONS || valueBB == null || valueBB.capacity() < value.length) { valueBB = ByteBuffer.wrap(value); } else { valueBB.position(0); valueBB.limit(value.length); valueBB.put(value); valueBB.position(0); } pairToCollect.set(keyBB, valueBB); getCollector().collect(pairToCollect); } }
/** Called with all map output values with a given key. By default, pairs * key with each value, collecting {@link Pair} instances. */ @SuppressWarnings("unchecked") public void reduce(K key, Iterable<V> values, AvroCollector<OUT> collector, Reporter reporter) throws IOException { if (outputPair == null) outputPair = new Pair<>(AvroJob.getOutputSchema(getConf())); for (V value : values) { outputPair.set(key, value); collector.collect((OUT)outputPair); } }
/** Called with all map output values with a given key. By default, pairs * key with each value, collecting {@link Pair} instances. */ @SuppressWarnings("unchecked") public void reduce(K key, Iterable<V> values, AvroCollector<OUT> collector, Reporter reporter) throws IOException { if (outputPair == null) outputPair = new Pair<K,V>(AvroJob.getOutputSchema(getConf())); for (V value : values) { outputPair.set(key, value); collector.collect((OUT)outputPair); } }
/** Called with all map output values with a given key. By default, pairs * key with each value, collecting {@link Pair} instances. */ @SuppressWarnings("unchecked") public void reduce(K key, Iterable<V> values, AvroCollector<OUT> collector, Reporter reporter) throws IOException { if (outputPair == null) outputPair = new Pair<K,V>(AvroJob.getOutputSchema(getConf())); for (V value : values) { outputPair.set(key, value); collector.collect((OUT)outputPair); } }