Java Code Examples for org.apache.avro.file.FileReader#sync()

The following examples show how to use org.apache.avro.file.FileReader#sync() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AvroIterable.java    From iceberg with Apache License 2.0 5 votes vote down vote up
AvroRangeIterator(FileReader<D> reader, long start, long end) {
  this.reader = reader;
  this.end = end;

  try {
    reader.sync(start);
  } catch (IOException e) {
    throw new RuntimeIOException(e, "Failed to find sync past position %d", start);
  }
}
 
Example 2
Source File: AvroIterable.java    From iceberg with Apache License 2.0 5 votes vote down vote up
AvroRangeIterator(FileReader<D> reader, long start, long end) {
  this.reader = reader;
  this.end = end;

  try {
    reader.sync(start);
  } catch (IOException e) {
    throw new RuntimeIOException(e, "Failed to find sync past position %d", start);
  }
}
 
Example 3
Source File: TestMerge.java    From aliyun-maxcompute-data-collectors with Apache License 2.0 5 votes vote down vote up
private boolean checkAvroFileForLine(FileSystem fs, Path p, List<Integer> record)
    throws IOException {
  SeekableInput in = new FsInput(p, new Configuration());
  DatumReader<GenericRecord> datumReader = new GenericDatumReader<GenericRecord>();
  FileReader<GenericRecord> reader = DataFileReader.openReader(in, datumReader);
  reader.sync(0);

  while (reader.hasNext()) {
    if (valueMatches(reader.next(), record)) {
      return true;
    }
  }

  return false;
}
 
Example 4
Source File: AvroAsTextRecordReaderCopy.java    From iow-hadoop-streaming with Apache License 2.0 5 votes vote down vote up
protected AvroAsTextRecordReaderCopy(FileReader<T> reader, FileSplit split)
        throws IOException {

    this.reader = reader;
    reader.sync(split.getStart());                    // sync to start
    this.start = reader.tell();
    this.end = split.getStart() + split.getLength();
}
 
Example 5
Source File: AvroAsTextInputFormat.java    From iow-hadoop-streaming with Apache License 2.0 5 votes vote down vote up
protected AvroAsTextRecordReader(FileReader<T> reader, FileSplit split)
        throws IOException {

    this.reader = reader;
    reader.sync(split.getStart());                    // sync to start
    this.start = reader.tell();
    this.end = split.getStart() + split.getLength();
    tsv = new GenericDataTSV();
}