Examples of collections()


Examples of org.apache.crunch.types.PTypeFamily.collections()

    PTable<K, Pair<U, V>> cgRight = right.parallelDo("coGroupTag2", new CogroupFn2<K, U, V>(),
        ptf.tableOf(keyType, itype));

    PTable<K, Pair<U, V>> both = cgLeft.union(cgRight);

    PType<Pair<Collection<U>, Collection<V>>> otype = ptf.pairs(ptf.collections(leftType), ptf.collections(rightType));
    return both.groupByKey().parallelDo("cogroup",
        new PostGroupFn<K, U, V>(leftType, rightType), ptf.tableOf(keyType, otype));
  }

  private static class CogroupFn1<K, V, U> extends MapValuesFn<K, V, Pair<V, U>> {
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

    public static <V1, V2, V3, V4> PType<Tuple4.Collect<V1, V2, V3, V4>> derived(PType<V1> first,
        PType<V2> second, PType<V3> third, PType<V4> fourth) {
      PTypeFamily tf = first.getFamily();
      PType<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>> pt =
          tf.quads(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third),
              tf.collections(fourth));
      Object clazz = Tuple4.Collect.class;
      return tf.derived((Class<Tuple4.Collect<V1, V2, V3, V4>>) clazz,
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

        PType<V2> second, PType<V3> third, PType<V4> fourth) {
      PTypeFamily tf = first.getFamily();
      PType<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>> pt =
          tf.quads(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third),
              tf.collections(fourth));
      Object clazz = Tuple4.Collect.class;
      return tf.derived((Class<Tuple4.Collect<V1, V2, V3, V4>>) clazz,
          new MapFn<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>,
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

      PTypeFamily tf = first.getFamily();
      PType<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>> pt =
          tf.quads(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third),
              tf.collections(fourth));
      Object clazz = Tuple4.Collect.class;
      return tf.derived((Class<Tuple4.Collect<V1, V2, V3, V4>>) clazz,
          new MapFn<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>,
          Collect<V1, V2, V3, V4>>() {
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

      PType<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>> pt =
          tf.quads(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third),
              tf.collections(fourth));
      Object clazz = Tuple4.Collect.class;
      return tf.derived((Class<Tuple4.Collect<V1, V2, V3, V4>>) clazz,
          new MapFn<Tuple4<Collection<V1>, Collection<V2>, Collection<V3>, Collection<V4>>,
          Collect<V1, V2, V3, V4>>() {
        @Override
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

            for (V value : values) {
              collected.add(valueType.getDetachedValue(value));
            }
            return collected;
          }
        }, tf.collections(collect.getValueType()));
  }
 
  public static <S> PCollection<S> aggregate(PCollection<S> collect, Aggregator<S> aggregator) {
    PTypeFamily tf = collect.getTypeFamily();
    return collect.parallelDo("Aggregate.aggregator", new MapFn<S, Pair<Void, S>>() {
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

    public static <V1, V2, V3> PType<Tuple3.Collect<V1, V2, V3>> derived(PType<V1> first,
        PType<V2> second, PType<V3> third) {
      PTypeFamily tf = first.getFamily();
      PType<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>> pt =
          tf.triples(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third));
      Object clazz = Tuple3.Collect.class;
      return tf.derived((Class<Tuple3.Collect<V1, V2, V3>>) clazz,
          new MapFn<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>, Collect<V1, V2, V3>>() {
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

        PType<V2> second, PType<V3> third) {
      PTypeFamily tf = first.getFamily();
      PType<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>> pt =
          tf.triples(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third));
      Object clazz = Tuple3.Collect.class;
      return tf.derived((Class<Tuple3.Collect<V1, V2, V3>>) clazz,
          new MapFn<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>, Collect<V1, V2, V3>>() {
        @Override
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

      PTypeFamily tf = first.getFamily();
      PType<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>> pt =
          tf.triples(
              tf.collections(first),
              tf.collections(second),
              tf.collections(third));
      Object clazz = Tuple3.Collect.class;
      return tf.derived((Class<Tuple3.Collect<V1, V2, V3>>) clazz,
          new MapFn<Tuple3<Collection<V1>, Collection<V2>, Collection<V3>>, Collect<V1, V2, V3>>() {
        @Override
        public Collect<V1, V2, V3> map(
View Full Code Here

Examples of org.apache.crunch.types.PTypeFamily.collections()

      int numReducers,
      PTable<K, U> left,
      PTable<K, V> right) {
    PTypeFamily tf = left.getTypeFamily();
    return cogroup(
        tf.pairs(tf.collections(left.getValueType()),
                 tf.collections(right.getValueType())),
        TupleFactory.PAIR,
        numReducers,
        left, right);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.