Tabnine Logo
Pair.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
org.apache.crunch.Pair

Best Java code snippets using org.apache.crunch.Pair.of (Showing top 20 results out of 315)

origin: cloudera/crunch

 @Override
 public Pair makeTuple(Object... values) {
  return Pair.of(values[0], values[1]);
 }
};
origin: cloudera/crunch

 @Override
 public Pair<V, U> map(V v) {
  return Pair.of(v, null);
 }
}
origin: org.apache.crunch/crunch-core

 @Override
 public Pair<Double, Long> map(V input) {
  return Pair.of(input.doubleValue(), 1L);
 }
}, ptf.pairs(ptf.doubles(), ptf.longs()));
origin: cloudera/crunch

 @Override
 public void process(TupleN input,
   Emitter<Pair<TupleN, Void>> emitter) {
  emitter.emit(Pair.of(input, (Void) null));
 }
}, type);
origin: cloudera/crunch

 public void cleanup(Emitter<Pair<Integer, Pair<K, V>>> emitter) {
  for (Pair<K, V> p : values) {
   emitter.emit(Pair.of(0, p));
  }
 }
}
origin: cloudera/crunch

    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));
    } }));
}
origin: cloudera/crunch

    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));
    } }));
}
origin: org.apache.crunch/crunch-core

 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));
 }
}));
origin: cloudera/crunch

@Override
public void process(Pair<K, U> input, Emitter<Pair<K, Pair<U, V>>> emitter) {
 K key = input.first();
 U value = input.second();
 for (V joinValue : joinMap.get(key)) {
  Pair<U, V> valuePair = Pair.of(value, joinValue);
  emitter.emit(Pair.of(key, valuePair));
 }
}
origin: org.apache.crunch/crunch-core

 @Override
 public Pair map(GenericRecord input) {
  return Pair.of(
    firstMapFn.map(input.get(AvroKeyValue.KEY_FIELD)),
    secondMapFn.map(input.get(AvroKeyValue.VALUE_FIELD)));
 }
}
origin: org.apache.crunch/crunch-core

 @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)));
 }
}
origin: org.apache.crunch/crunch-core

@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()));
 }
}
origin: org.apache.crunch/crunch-core

 @Override
 public Pair<V2, V1> map(Pair<V1, V2> input) {
  if (input == null) {
   return null;
  }
  return Pair.of(input.second(), input.first());
 }
}
origin: org.apache.crunch/crunch-core

 @Override
 public Pair<S, T> next() {
  return Pair.of((S) next(0), (T) next(1));
 }
};
origin: org.apache.crunch/crunch-core

 @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()));
 }
}
origin: cloudera/crunch

 @Override
 public Pair<K, V> next() {
  if (!nextChecked && !hasNext()) {
   return null;
  }
  nextChecked = false;
  return Pair.of(keyMapFn.map(key), valueMapFn.map(value));
 }
};
origin: org.apache.crunch/crunch-core

 @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));
origin: cloudera/crunch

 @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()));
origin: org.apache.crunch/crunch-core

/**
 * 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()));
}
origin: org.apache.crunch/crunch-core

 @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));
  }
 }
}
org.apache.crunchPairof

Popular methods of Pair

  • second
  • first
  • <init>
  • cmp

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now