Package org.apache.avro.file

Examples of org.apache.avro.file.FileReader


 
  public static void assertOutput(String output, Configuration conf)
      throws NumberFormatException, IOException, InterruptedException {

    DatumReader datumReader = new SpecificDatumReader(AvroTweetsJoin.getAvroOutputSchema());
    FileReader reader = DataFileReader.openReader(new File(output),datumReader);
   
    Record record=null;
    record = (Record)reader.next(record);
   
    Assert.assertEquals("eric",record.get("username").toString());
    Array<Utf8> hashtags = (Array<Utf8>)record.get("hashtags");
    assertEquals(hashtags,"ivan","datasalt","pere");
   
    reader.next(record);
    Assert.assertEquals("eric",record.get("username").toString());
    assertEquals(hashtags,"ivan2","datasalt2","pere2");
    reader.next(record);
    Assert.assertEquals("marianico",record.get("username").toString());
    assertEquals(hashtags,"ivan2","datasalt2","pere2");
   
    Assert.assertFalse(reader.hasNext());
   
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.file.FileReader

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.