org.apache.avro.file.FileReader.tell()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.apache.avro.file.FileReader.tell()方法的一些代码示例,展示了FileReader.tell()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileReader.tell()方法的具体详情如下:
包路径:org.apache.avro.file.FileReader
类名称:FileReader
方法名:tell

FileReader.tell介绍

[英]Return the current position in the input.
[中]返回输入中的当前位置。

代码示例

代码示例来源:origin: apache/hive

@Override
public long getPos() throws IOException {
 return isEmptyInput ? 0 : reader.tell();
}

代码示例来源:origin: apache/avro

public long getPos() throws IOException {
 return reader.tell();
}

代码示例来源:origin: apache/avro

public long getPos() throws IOException {
 return reader.tell();
}

代码示例来源:origin: apache/avro

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();
}

代码示例来源:origin: apache/avro

protected AvroRecordReader(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();
}

代码示例来源:origin: apache/hive

public AvroGenericRecordReader(JobConf job, FileSplit split, Reporter reporter) throws IOException {
 this.jobConf = job;
 Schema latest;
 try {
  latest = getSchema(job, split);
 } catch (AvroSerdeException e) {
  throw new IOException(e);
 }
 GenericDatumReader<GenericRecord> gdr = new GenericDatumReader<GenericRecord>();
 if(latest != null) {
  gdr.setExpected(latest);
 }
 if (split.getLength() == 0) {
  this.isEmptyInput = true;
  this.start = 0;
  this.reader = null;
 }
 else {
  this.isEmptyInput = false;
  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();
}

代码示例来源:origin: Netflix/iceberg

@Override
public long tell() throws IOException {
 return reader.tell();
}

代码示例来源:origin: org.apache.crunch/crunch-core

public long getPos() throws IOException {
 return reader.tell();
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public long getPos() throws IOException {
 return reader.tell();
}

代码示例来源:origin: datasalt/pangool

public long getPos() throws IOException {
 return reader.tell();
}

代码示例来源:origin: org.apache.pig/pig

@Override
public float getProgress() throws IOException, InterruptedException {
 if (start == end) {
  return 0.0f;
 } else {
  return Math.min(1.0f,
    ((float) (reader.tell() - start)) / ((float) (end - start)));
 }
}

代码示例来源:origin: org.apache.pig/pig

@Override
public float getProgress() throws IOException, InterruptedException {
 if (start == end) {
  return 0.0f;
 } else {
  return Math.min(1.0f,
    ((float) (reader.tell() - start)) / ((float) (end - start)));
 }
}

代码示例来源:origin: com.google.cloud.bigdataoss/bigquery-connector

@Override
public float getProgress() throws IOException, InterruptedException {
 Preconditions.checkState(dataFileReader != null);
 if (splitLength == 0) {
  return 1.0f;
 }
 float splitRelativeLocation = dataFileReader.tell() - splitStart;
 return splitRelativeLocation / splitLength;
}

代码示例来源:origin: org.apache.avro/avro-mapred

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();
}

代码示例来源:origin: com.datasalt.pangool/pangool-core

protected void init(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();
 }

代码示例来源:origin: com.datasalt.pangool/pangool-core

protected void init(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();
 }

代码示例来源:origin: org.apache.avro/avro-mapred

protected AvroRecordReader(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();
}

代码示例来源:origin: datasalt/pangool

protected void init(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();
 }

代码示例来源:origin: jwills/avro-json

protected AvroAsJSONRecordReader(FileReader<GenericRecord> reader, FileSplit split)
  throws IOException {
 this.reader = reader;
 reader.sync(split.getStart());
 this.start = reader.tell();
 this.end = split.getStart() + split.getLength();
}

代码示例来源:origin: org.apache.crunch/crunch-core

@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
 this.start = reader.tell();
 this.end = split.getStart() + split.getLength();
}

相关文章