@Override public Pair makeTuple(Object... values) { return Pair.of(values[0], values[1]); } };
@Override public Pair<V, U> map(V v) { return Pair.of(v, null); } }
@Override public Pair<Double, Long> map(V input) { return Pair.of(input.doubleValue(), 1L); } }, ptf.pairs(ptf.doubles(), ptf.longs()));
@Override public void process(TupleN input, Emitter<Pair<TupleN, Void>> emitter) { emitter.emit(Pair.of(input, (Void) null)); } }, type);
public void cleanup(Emitter<Pair<Integer, Pair<K, V>>> emitter) { for (Pair<K, V> p : values) { emitter.emit(Pair.of(0, p)); } } }
public void process(Pair<Boolean, Iterable<S>> input, Emitter<Pair<Boolean, S>> emitter) { S max = null; for (S v : input.second()) { if (max == null || ((Comparable<S>) max).compareTo(v) < 0) { max = v; } } emitter.emit(Pair.of(input.first(), max)); } })); }
public void process(Pair<Boolean, Iterable<S>> input, Emitter<Pair<Boolean, S>> emitter) { S min = null; for (S v : input.second()) { if (min == null || ((Comparable<S>) min).compareTo(v) > 0) { min = v; } } emitter.emit(Pair.of(input.first(), min)); } })); }
public void process(Pair<Boolean, Iterable<S>> input, Emitter<Pair<Boolean, S>> emitter) { S min = null; for (S v : input.second()) { if (min == null || ((Comparable<S>) min).compareTo(v) > 0) { min = v; } } emitter.emit(Pair.of(input.first(), min)); } }));
@Override public Pair map(GenericRecord input) { return Pair.of( firstMapFn.map(input.get(AvroKeyValue.KEY_FIELD)), secondMapFn.map(input.get(AvroKeyValue.VALUE_FIELD))); } }
@Override public Pair<K, Result<V>> map(Pair<K, Iterable<V>> input) { List<V> values = Lists.newArrayList(input.second().iterator()); Collections.sort(values); return Pair.of(input.first(), new Result<V>(values.size(), findQuantiles(values.iterator(), values.size(), quantileList))); } }
@Override public void process(Pair<K, U> input, Emitter<Pair<Pair<K, Integer>, U>> emitter) { K key = input.first(); int numShards = shardingStrategy.getNumShards(key); if (numShards < 1) { throw new IllegalArgumentException("Num shards must be > 0, got " + numShards + " for " + key); } for (int i = 0; i < numShards; i++) { emitter.emit(Pair.of(Pair.of(key, i), input.second())); } }
@Override public Pair<V2, V1> map(Pair<V1, V2> input) { if (input == null) { return null; } return Pair.of(input.second(), input.first()); } }
@Override public Pair<S, T> next() { return Pair.of((S) next(0), (T) next(1)); } };
@Override public void add(Pair<Pair<K, SK>, V> record) { K primary = record.first().first(); if (!map.containsKey(primary)) { map.put(primary, Lists.<Pair<SK, V>>newArrayList()); } map.get(primary).add(Pair.of(record.first().second(), record.second())); } }
@Override public Pair<K, V> next() { if (!nextChecked && !hasNext()) { return null; } nextChecked = false; return Pair.of(keyMapFn.map(key), valueMapFn.map(value)); } };
@Override public Pair<Integer, T> map(Pair<Integer, Pair<Double, T>> p) { return Pair.of(p.first(), p.second().second()); } }, ptf.pairs(ptf.ints(), ttype));
@Override public void process( Pair<Pair<Integer, Integer>, Pair<Collection<U>, Collection<V>>> input, Emitter<Pair<U,V>> emitter) { for (U l: input.second().first()) { for (V r: input.second().second()) { emitter.emit(Pair.of(l, r)); } } } }, ctf.pairs(left.getPType(), right.getPType()));
/** * Create a detached value for a table {@link Pair}. * * @param tableType The table type * @param value The value from which a detached value is to be created * @return The detached value * @see PType#getDetachedValue(Object) */ public static <K, V> Pair<K, V> getDetachedValue(PTableType<K, V> tableType, Pair<K, V> value) { return Pair.of(tableType.getKeyType().getDetachedValue(value.first()), tableType.getValueType() .getDetachedValue(value.second())); }
@Override public void process(Pair<K, Iterable<V>> input, Emitter<Pair<K, V>> emitter) { aggregator.reset(); for (V v : input.second()) { aggregator.update(ptype == null ? v : ptype.getDetachedValue(v)); } for (V v : aggregator.results()) { emitter.emit(Pair.of(input.first(), v)); } } }