Package org.apache.crunch.test.orc.pojos

Examples of org.apache.crunch.test.orc.pojos.Person


   
    AddressBook ab = new AddressBook();
    ab.setMyName("John Smith");
    ab.setMyNumbers(Arrays.asList("919-333-4452", "650-777-4329"));
    Map<String, Person> contacts = new HashMap<String, Person>();
    contacts.put("Alice", new Person("Alice", 23, Arrays.asList("666-677-9999")));
    contacts.put("Bob", new Person("Bob", 26, Arrays.asList("999-888-1132", "000-222-9934")));
    contacts.put("David", null);
    ab.setContacts(contacts);
    Timestamp now = new Timestamp(System.currentTimeMillis());
    ab.setUpdateTime(now);
    byte[] signature = {0, 0, 64, 68, 39, 0};
View Full Code Here


  @Test
  public void testTuples() {
    PType<TupleN> ptype = Orcs.tuples(Writables.ints(), Writables.strings(), Orcs.reflects(Person.class),
        Writables.tableOf(Writables.strings(), Orcs.reflects(Person.class)));
   
    TupleN t = new TupleN(1, "John Smith", new Person("Alice", 23, Arrays.asList("666-677-9999")),
        new Pair<String, Person>("Bob", new Person("Bob", 26, Arrays.asList("999-888-1132", "000-222-9934"))));
   
    String typeStr = "struct<a:int,b:string,c:" + Person.TYPE_STR + ",d:struct<d1:string,d2:" + Person.TYPE_STR + ">>";
    TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(typeStr);
    String tableTypeStr = "struct<a:string,b:" + Person.TYPE_STR + ">";
    TypeInfo tableTypeInfo = TypeInfoUtils.getTypeInfoFromTypeString(tableTypeStr);
View Full Code Here

  }
 
  @Test
  public void testReflects() throws IOException {
    generateInputData();
    Person expected = new Person("Alice", 23, Arrays.asList("919-342-5555", "650-333-2913"));
    testSourceTarget(Orcs.reflects(Person.class), expected);
  }
View Full Code Here

    OrcFileSource<Person> source = new OrcFileSource<Person>(new Path(tempPath, "input.orc"),
        Orcs.reflects(Person.class), readColumns);
    PCollection<Person> rows = pipeline.read(source);
    List<Person> result = Lists.newArrayList(rows.materialize());
   
    Person expected = new Person("Alice", 23, null);
    assertEquals(Lists.newArrayList(expected), result);
  }
View Full Code Here

    PCollection<Person> rows = pipeline.read(source);
    PTable<Person, Long> count = rows.count();

    List<Pair<Person, Long>> result = Lists.newArrayList(count.materialize());
    List<Pair<Person, Long>> expected = Lists.newArrayList(
        Pair.of(new Person("Alice", 23, Arrays.asList("444-333-9999")), 1L),
        Pair.of(new Person("Alice", 36, Arrays.asList("919-342-5555", "650-333-2913")), 1L),
        Pair.of(new Person("Bob", 28, null), 2L));
   
    assertEquals(expected, result);
  }
View Full Code Here

  public void testReadWrite() throws IOException {
    Path path = new Path(tempPath, "test.orc");
    PType<Person> ptype = Orcs.reflects(Person.class);
    OrcFileWriter<Person> writer = new OrcFileWriter<Person>(conf, path, ptype);
   
    Person p1 = new Person("Alice", 23, Arrays.asList("666-677-9999"));
    Person p2 = new Person("Bob", 26, null);
   
    writer.write(p1);
    writer.write(p2);
    writer.close();
   
View Full Code Here

TOP

Related Classes of org.apache.crunch.test.orc.pojos.Person

Copyright © 2018 www.massapicom. 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.