Package org.apache.trevni

Examples of org.apache.trevni.ColumnFileMetaData


    boolean isMapOnly = job.getNumReduceTasks() == 0;
    final Schema schema = isMapOnly
      ? AvroJob.getMapOutputSchema(job)
      : AvroJob.getOutputSchema(job);

    final ColumnFileMetaData meta = filterMetadata(job);

    final Path dir = FileOutputFormat.getTaskOutputPath(job, name);
    final FileSystem fs = dir.getFileSystem(job);
    if (!fs.mkdirs(dir))
      throw new IOException("Failed to create directory: " + dir);
View Full Code Here


      }
    };
  }

   static ColumnFileMetaData filterMetadata(final JobConf job) {
    final ColumnFileMetaData meta = new ColumnFileMetaData();
    for (Map.Entry<String,String> e : job)
      if (e.getKey().startsWith(META_PREFIX))
        meta.put(e.getKey().substring(META_PREFIX.length()),
                 e.getValue().getBytes(MetaData.UTF8));
    return meta;
  }
View Full Code Here

    File outputFile = new File(args.get(2));

    Schema schema = Schema.parse(schemaFile);

    AvroColumnWriter<Object> writer =
      new AvroColumnWriter<Object>(schema, new ColumnFileMetaData());

    for (Object datum : new RandomData(schema, count))
      writer.write(datum);

    writer.writeTo(outputFile);
View Full Code Here

    Schema schema = Schema.parse(new File(dir, "input.avsc"));
    List<Object> data = fromJson(schema, new File(dir, "input.json"));

    // write full data
    AvroColumnWriter<Object> writer =
      new AvroColumnWriter<Object>(schema, new ColumnFileMetaData());
    for (Object datum : data)
      writer.write(datum);
    writer.writeTo(FILE);

    // test that the full schema reads correctly
View Full Code Here

TOP

Related Classes of org.apache.trevni.ColumnFileMetaData

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.