Package org.apache.avro.mapred

Examples of org.apache.avro.mapred.FsInput


  @Override
  public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException {
    FileSplit split = (FileSplit) genericSplit;
    Configuration conf = context.getConfiguration();
    SeekableInput in = new FsInput(split.getPath(), conf);
    DatumReader<T> datumReader = null;
    if (context.getConfiguration().getBoolean(AvroJob.INPUT_IS_REFLECT, true)) {
      ReflectDataFactory factory = Avros.getReflectDataFactory(conf);
      datumReader = factory.getReader(schema);
    } else {
View Full Code Here


    if(latest != null) {
      gdr.setExpected(latest);
    }

    this.reader = new DataFileReader<GenericRecord>(new FsInput(split.getPath(), job), gdr);
    this.reader.sync(split.getStart());
    this.start = reader.tell();
    this.stop = split.getStart() + split.getLength();
    this.recordReaderID = new UID();
  }
View Full Code Here

      Schema recordSchema = AvroKeyValue.getSchema(mKeySchema, options.getValueSchema());
      DatumReader<GenericRecord> datumReader =
        model.createDatumReader(recordSchema);
      mDataFileReader =
        new DataFileReader<GenericRecord>
        (new FsInput(dataFilePath, options.getConfiguration()), datumReader);
     
    }
View Full Code Here

    private <K> NavigableMap<K, Long> loadIndexFile(
        Configuration conf, Path path, Schema keySchema) throws IOException {
      DatumReader<GenericRecord> datumReader = model.createDatumReader(
          AvroKeyValue.getSchema(keySchema, Schema.create(Schema.Type.LONG)));
      DataFileReader<GenericRecord> fileReader = new DataFileReader<GenericRecord>(
          new FsInput(path, conf), datumReader);

      NavigableMap<K, Long> index;
      if (Schema.create(Schema.Type.STRING).equals(keySchema)) {
        // Because Avro STRING types are mapped to the Java CharSequence class that does not
        // mandate the implementation of Comparable, we need to specify a special
View Full Code Here

    if (nargs.size() != 1) {
      err.println("Expected 1 arg: input_file");
      p.printHelpOn(err);
      return 1;
    }
    FsInput in = Util.openSeekableFromFS(args.get(0));
    DataFileReader<Void> reader =
      new DataFileReader<Void>(in, new GenericDatumReader<Void>());
    if (keyName != null) {
      byte[] value = reader.getMeta(keyName);
      if (value != null) {
View Full Code Here

   * @param filename The filename to be opened
   * @throws IOException
   */
  static FsInput openSeekableFromFS(String filename)
      throws IOException {      
    return new FsInput(new Path(filename), new Configuration());
  }
View Full Code Here

    if(latest != null) {
      gdr.setExpected(latest);
    }

    this.reader = new DataFileReader<GenericRecord>(new FsInput(split.getPath(), job), gdr);
    this.reader.sync(split.getStart());
    this.start = reader.tell();
    this.stop = split.getStart() + split.getLength();
    this.recordReaderID = new UID();
  }
View Full Code Here

    if (nargs.size() != 1) {
      err.println("Expected 1 arg: input_file");
      p.printHelpOn(err);
      return 1;
    }
    FsInput in = Util.openSeekableFromFS(args.get(0));
    DataFileReader<Void> reader =
      new DataFileReader<Void>(in, new GenericDatumReader<Void>());
    if (keyName != null) {
      byte[] value = reader.getMeta(keyName);
      if (value != null) {
View Full Code Here

    GenericDatumReader<GenericRecord> gdr = new GenericDatumReader<GenericRecord>();

    if(latest != null) gdr.setExpected(latest);

    this.reader = new DataFileReader<GenericRecord>(new FsInput(split.getPath(), job), gdr);
    this.reader.sync(split.getStart());
    this.start = reader.tell();
    this.stop = split.getStart() + split.getLength();
  }
View Full Code Here

  }
 
  public void initialize(FileSplit split,Configuration conf)
      throws IOException, InterruptedException{
      init(DataFileReader.openReader
        (new FsInput(split.getPath(), conf),
         conf.getBoolean(AvroJob.INPUT_IS_REFLECT, false)
         ? new ReflectDatumReader<T>(AvroJob.getInputSchema(conf))
         : new SpecificDatumReader<T>(AvroJob.getInputSchema(conf))),
        split);
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.mapred.FsInput

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.