Examples of FsInput


Examples of org.apache.avro.mapred.FsInput

  @Override
  public Iterator<T> read(FileSystem fs, final Path path) {
    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

Examples of org.apache.avro.mapred.FsInput

 
  /**
   * Read the Avro schema from the first file in the input directory.
   */
  private Schema readSchema(Path inputDir, Configuration conf) throws IOException {
    FsInput fsInput = null;
    FileReader<Object> reader = null;
    try {
      fsInput = new FsInput(new Path(inputDir, "part-m-00000.avro"), conf);
      reader = DataFileReader.openReader(fsInput, new GenericDatumReader<Object>());
      return reader.getSchema();
    } finally {
      IOUtils.closeStream(fsInput);
      IOUtils.closeStream(reader);
View Full Code Here

Examples of org.apache.avro.mapred.FsInput

        if (fstat == null || fstat.length == 0) {
          throw new IllegalArgumentException("No valid files found in directory: " + path);
        }
        path = fstat[0].getPath();
      }
      reader = new DataFileReader(new FsInput(path, conf), new GenericDatumReader<GenericRecord>());
      return reader.getSchema();
    } catch (IOException e) {
      throw new RuntimeException("Error reading schema from path: "  + path, e);
    } finally {
      if (reader != null) {
View Full Code Here

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 = AvroMode
        .fromConfiguration(context.getConfiguration())
        .getReader(schema);
    this.reader = DataFileReader.openReader(in, datumReader);
    reader.sync(split.getStart()); // sync to start
View Full Code Here

Examples of org.apache.avro.mapred.FsInput

  public Iterator<T> read(FileSystem fs, final Path path) {
    AvroMode mode = AvroMode.fromType(atype).withFactoryFromConfiguration(fs.getConf());
    final DatumReader recordReader = reader == null ? mode.getReader(atype.getSchema()) : reader;
    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

Examples of org.apache.avro.mapred.FsInput

    start  = fsplit.getStart();
    end    = fsplit.getStart() + fsplit.getLength();
    DatumReader<GenericData.Record> datumReader
      = new GenericDatumReader<GenericData.Record>(schema);
    reader = DataFileReader.openReader(
        new FsInput(fsplit.getPath(), tc.getConfiguration()),
        datumReader);
    reader.sync(start);
  }
View Full Code Here

Examples of org.apache.avro.mapred.FsInput

    start  = fsplit.getStart();
    end    = fsplit.getStart() + fsplit.getLength();
    DatumReader<GenericData.Array<Object>> datumReader
      = new GenericDatumReader<GenericData.Array<Object>>(schema);
    reader = DataFileReader.openReader(
        new FsInput(fsplit.getPath(), tc.getConfiguration()),
        datumReader);
    reader.sync(start);
  }
View Full Code Here

Examples of org.apache.gora.avro.mapreduce.FsInput

  }
  @Override
  protected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query) {
    try{
      FsInput fsInput = createFsInput();
      DataFileReader<T> reader = createReader(fsInput);
      return new DataFileAvroResult<K, T>(this, query, reader, fsInput
          , query.getStart(), query.getLength());
    } catch(IOException ex){
      LOG.error(ex.getMessage());
View Full Code Here

Examples of org.apache.gora.avro.mapreduce.FsInput

    return new DataFileReader<T>(fsInput, getDatumReader());
  }
 
  private FsInput createFsInput() throws IOException {
    Path path = new Path(getInputPath());
    return new FsInput(path, getConf());
  }
View Full Code Here

Examples of org.apache.gora.avro.mapreduce.FsInput

  }
  @Override
  protected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query)
    throws IOException {
    FsInput fsInput = createFsInput();
    DataFileReader<T> reader = createReader(fsInput);
    return new DataFileAvroResult<K, T>(this, query, reader, fsInput
        , query.getStart(), query.getLength());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.