Package org.apache.trevni

Examples of org.apache.trevni.ColumnFileMetaData


      InterruptedException {
    flush();
  }
 
  static ColumnFileMetaData filterMetadata(final Configuration configuration) {
    final ColumnFileMetaData meta = new ColumnFileMetaData();
    Iterator<Entry<String, String>> keyIterator = configuration.iterator();

    while (keyIterator.hasNext()) {
      Entry<String, String> confEntry = keyIterator.next();
      if (confEntry.getKey().startsWith(META_PREFIX))
        meta.put(confEntry.getKey().substring(META_PREFIX.length()), confEntry
            .getValue().getBytes(MetaData.UTF8));
    }

    return meta;
  }
View Full Code Here


          if (schema == null) {
            throw new IOException("Null output schema");
          }
        }

        final ColumnFileMetaData meta = new ColumnFileMetaData();

        for (Entry<String, String> e : tc.getConfiguration()) {
          if (e.getKey().startsWith(
              org.apache.trevni.avro.AvroTrevniOutputFormat.META_PREFIX)) {
            meta.put(e.getKey().substring(AvroJob.TEXT_PREFIX.length()),
                e.getValue().getBytes(MetaData.UTF8));
          }
        }
       
        final Path dir = getOutputPath(tc);
        final FileSystem fs = FileSystem.get(tc.getConfiguration());
        final long blockSize = fs.getDefaultBlockSize();

        if (!fs.mkdirs(dir)) {
          throw new IOException("Failed to create directory: " + dir);
        }

        meta.setCodec("deflate");

        return new AvroRecordWriter(dir, tc.getConfiguration()) {
          private int part = 0;
          private Schema avroRecordWriterSchema;
          private AvroColumnWriter<GenericData.Record> writer;
View Full Code Here

          if (schema == null) {
            throw new IOException("Null output schema");
          }
        }

        final ColumnFileMetaData meta = new ColumnFileMetaData();

        for (Entry<String, String> e : tc.getConfiguration()) {
          if (e.getKey().startsWith(
              org.apache.trevni.avro.AvroTrevniOutputFormat.META_PREFIX)) {
            meta.put(e.getKey().substring(AvroJob.TEXT_PREFIX.length()),
                e.getValue().getBytes(MetaData.UTF8));
          }
        }
       
        final Path dir = getOutputPath(tc);
        final FileSystem fs = FileSystem.get(tc.getConfiguration());
        final long blockSize = fs.getDefaultBlockSize();

        if (!fs.mkdirs(dir)) {
          throw new IOException("Failed to create directory: " + dir);
        }

        meta.setCodec("deflate");

        return new AvroRecordWriter(dir, tc.getConfiguration()) {
          private int part = 0;
          private Schema avroRecordWriterSchema;
          private AvroColumnWriter<GenericData.Record> writer;
View Full Code Here

    super.init();
  }

  private ColumnFileMetaData createFileMeta() {
    return new ColumnFileMetaData()
        .setCodec("null")
        .setChecksum("null");
  }
View Full Code Here

          String schemaString = getProperties(ResourceSchema.class, null).getProperty(OUTPUT_AVRO_SCHEMA);
          if (schemaString != null)
            schema = (new Schema.Parser()).parse(schemaString);
        }

        final ColumnFileMetaData meta = new ColumnFileMetaData();
        final Path dir = getOutputPath(tc);
        final FileSystem fs = FileSystem.get(tc.getConfiguration());
        final long blockSize = fs.getDefaultBlockSize();
       
        if (!fs.mkdirs(dir))
          throw new IOException("Failed to create directory: " + dir);

        meta.setCodec("snappy");
       
        return new RecordWriter<NullWritable, Object>() {
          private int part = 0;
          private AvroColumnWriter<GenericData.Record> writer =
              new AvroColumnWriter<GenericData.Record>(schema, meta);
View Full Code Here

          String schemaString = getProperties(ResourceSchema.class, null).getProperty(OUTPUT_AVRO_SCHEMA);
          if (schemaString != null)
            schema = (new Schema.Parser()).parse(schemaString);
        }

        final ColumnFileMetaData meta = new ColumnFileMetaData();
        final Path dir = getOutputPath(tc);
        final FileSystem fs = FileSystem.get(tc.getConfiguration());
        final long blockSize = fs.getDefaultBlockSize();
       
        if (!fs.mkdirs(dir))
          throw new IOException("Failed to create directory: " + dir);

        meta.setCodec("snappy");
       
        return new RecordWriter<NullWritable, Object>() {
          private int part = 0;
          private AvroColumnWriter<GenericData.Record> writer =
              new AvroColumnWriter<GenericData.Record>(schema, 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

      InterruptedException {
    flush();
  }
 
  static ColumnFileMetaData filterMetadata(final Configuration configuration) {
    final ColumnFileMetaData meta = new ColumnFileMetaData();
    Iterator<Entry<String, String>> keyIterator = configuration.iterator();

    while (keyIterator.hasNext()) {
      Entry<String, String> confEntry = keyIterator.next();
      if (confEntry.getKey().startsWith(META_PREFIX))
        meta.put(confEntry.getKey().substring(META_PREFIX.length()), confEntry
            .getValue().getBytes(MetaData.UTF8));
    }

    return meta;
  }
View Full Code Here

      new DataFileStream(Util.fileOrStdin(args.get(0), stdin),
                         new GenericDatumReader<Object>());
    OutputStream outs = Util.fileOrStdout(args.get(1), out);
    AvroColumnWriter<Object> writer =
      new AvroColumnWriter<Object>(reader.getSchema(),
                                   new ColumnFileMetaData()
                                   .setCodec(codec.value(opts)));
    for (Object datum : reader)
      writer.write(datum);
    writer.writeTo(outs);
    outs.close();
View Full Code Here

      new DataFileStream(Util.fileOrStdin(args.get(0), stdin),
                         new GenericDatumReader<Object>());
    OutputStream outs = Util.fileOrStdout(args.get(1), out);
    AvroColumnWriter<Object> writer =
      new AvroColumnWriter<Object>(reader.getSchema(),
                                   new ColumnFileMetaData()
                                   .setCodec(codec.value(opts)));
    for (Object datum : reader)
      writer.write(datum);
    writer.writeTo(outs);
    outs.close();
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.