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();
  }
View Full Code Here

    /*
     * To be used when used externally
     */
    public void initialize(Path path, Configuration conf) throws IOException {
      FsInput fSInput = new FsInput(path, conf);
      reader = DataFileReader.openReader(fSInput, specificReader);
      end = Long.MAX_VALUE;
      reader.sync(0);
      start = reader.tell();
    }
View Full Code Here

        if (schema != null)
          return schema;
      }
      else if (f.getPath().getName().endsWith(".avro"))
      {
        FsInput fi = new FsInput(f.getPath(), fs.getConf());
        GenericDatumReader<GenericRecord> genReader = new GenericDatumReader<GenericRecord>();
        DataFileReader<GenericRecord> reader = new DataFileReader<GenericRecord>(fi, genReader);
        return reader.getSchema();
      }
    }
View Full Code Here

   * @param path The path to the avro container file.
   * @throws IOException If there is an error reading from the path.
   */
  protected SeekableInput createSeekableInput(Configuration conf, Path path)
      throws IOException {
    return new FsInput(path, conf);
  }
View Full Code Here

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

    /*
     * To be used when used externally
     */
    public void initialize(Path path, Configuration conf) throws IOException {
      FsInput fSInput = new FsInput(path, conf);
      reader = DataFileReader.openReader(fSInput, specificReader);
      end = Long.MAX_VALUE;
      reader.sync(0);
      start = reader.tell();
    }
View Full Code Here

  @Override
  public Iterator<T> read(FileSystem fs, final Path path) {
    this.mapFn.setConfigurationForTest(conf);
    this.mapFn.initialize();
    try {
      FsInput fsi = new FsInput(path, fs.getConf());
      final DataFileReader<T> reader = new DataFileReader<T>(fsi, recordReader);
      return new AutoClosingIterator<T>(reader, new UnmodifiableIterator<T>() {
        @Override
        public boolean hasNext() {
          return reader.hasNext();
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

   * @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

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.