Examples of TupleN


Examples of org.apache.crunch.TupleN

  @Test
  public void testGetDetachedValue_TupleN() {
    Person person = createPerson();
    AvroType<TupleN> ptype = Avros.tuples(Avros.records(Person.class));
    ptype.initialize(new Configuration());
    TupleN tuple = new TupleN(person);
    TupleN detachedTuple = ptype.getDetachedValue(tuple);

    assertEquals(tuple, detachedTuple);
    assertNotSame(person, detachedTuple.get(0));
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  @SuppressWarnings("rawtypes")
  public void testTupleN() throws Exception {
    AvroType at = Avros.tuples(Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings());
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    GenericData.Record w = new GenericData.Record(at.getSchema());
    w.put(0, new Utf8("a"));
    w.put(1, new Utf8("b"));
    w.put(2, new Utf8("c"));
    w.put(3, new Utf8("d"));
View Full Code Here

Examples of org.apache.crunch.TupleN

    testInputOutputFn(wt, j, w);
  }

  @Test
  public void testTupleN() throws Exception {
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    Text[] t = new Text[] { new Text("a"), new Text("b"), new Text("c"), new Text("d"),
        new Text("e"), };
    TupleWritable w = new TupleWritable(t);
    WritableType<?, ?> wt = Writables.tuples(Writables.strings(), Writables.strings(), Writables.strings(),
        Writables.strings(), Writables.strings());
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  public void testGetDetachedValue_TupleN() {
    Person person = createPerson();
    AvroType<TupleN> ptype = Avros.tuples(Avros.records(Person.class));
    ptype.initialize(new Configuration());
    TupleN tuple = new TupleN(person);
    TupleN detachedTuple = ptype.getDetachedValue(tuple);

    assertEquals(tuple, detachedTuple);
    assertNotSame(person, detachedTuple.get(0));
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  @SuppressWarnings("rawtypes")
  public void testTupleN() throws Exception {
    AvroType at = Avros.tuples(Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings());
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    GenericData.Record w = new GenericData.Record(at.getSchema());
    w.put(0, new Utf8("a"));
    w.put(1, new Utf8("b"));
    w.put(2, new Utf8("c"));
    w.put(3, new Utf8("d"));
View Full Code Here

Examples of org.apache.crunch.TupleN

    testInputOutputFn(wt, j, w);
  }

  @Test
  public void testTupleN() throws Exception {
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    TupleWritable w = new TupleWritable(new Text[] { new Text("a"), new Text("b"), new Text("c"), new Text("d"),
        new Text("e"), });
    w.setWritten(0);
    w.setWritten(1);
    w.setWritten(2);
View Full Code Here

Examples of org.apache.crunch.TupleN

    Arrays.fill(types, typeFamily.strings());
    PCollection<TupleN> kv = input.parallelDo(new DoFn<String, TupleN>() {
      @Override
      public void process(String input, Emitter<TupleN> emitter) {
        String[] split = input.split("[\t]+");
        emitter.emit(new TupleN(split));
      }
    }, typeFamily.tuples(types));
    PCollection<TupleN> sorted = Sort.sortTuples(kv, orders);
    Iterable<TupleN> lines = sorted.materialize();
    TupleN l = lines.iterator().next();
    int i = 0;
    for (String field : fields) {
      assertEquals(field, l.get(i++));
    }
    pipeline.done();
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  @SuppressWarnings("rawtypes")
  public void testTupleN() throws Exception {
    AvroType at = Avros.tuples(Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings());
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    GenericData.Record w = new GenericData.Record(at.getSchema());
    w.put(0, new Utf8("a"));
    w.put(1, new Utf8("b"));
    w.put(2, new Utf8("c"));
    w.put(3, new Utf8("d"));
View Full Code Here

Examples of org.apache.crunch.TupleN

        public TupleN next() {
          Object[] values = new Object[iters.length];
          for (int i = 0; i < values.length; i++) {
            values[i] = next(i);
          }
          return new TupleN(values);
        }
      };
    }
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  public void testGetDetachedValue_TupleN() {
    Person person = createPerson();
    AvroType<TupleN> ptype = Avros.tuples(Avros.records(Person.class));
    ptype.initialize(new Configuration());
    TupleN tuple = new TupleN(person);
    TupleN detachedTuple = ptype.getDetachedValue(tuple);

    assertEquals(tuple, detachedTuple);
    assertNotSame(person, detachedTuple.get(0));
  }
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.