org.apache.hadoop.mapreduce.RecordReader.initialize()方法的使用及代码示例

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

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

RecordReader.initialize介绍

[英]Called once at initialization.
[中]初始化时调用一次。

代码示例

代码示例来源:origin: thinkaurelius/titan

@Override
public void initialize(final InputSplit inputSplit, final TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
  reader.initialize(inputSplit, taskAttemptContext);
}

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

@Override
public void open(HadoopInputSplit split) throws IOException {
  TaskAttemptContext context = new TaskAttemptContextImpl(configuration, new TaskAttemptID());
  try {
    this.recordReader = this.hCatInputFormat
        .createRecordReader(split.getHadoopInputSplit(), context);
    this.recordReader.initialize(split.getHadoopInputSplit(), context);
  } catch (InterruptedException e) {
    throw new IOException("Could not create RecordReader.", e);
  } finally {
    this.fetched = false;
  }
}

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

@Override
public void open(HadoopInputSplit split) throws IOException {
  // enforce sequential open() calls
  synchronized (OPEN_MUTEX) {
    TaskAttemptContext context = new TaskAttemptContextImpl(configuration, new TaskAttemptID());
    try {
      this.recordReader = this.mapreduceInputFormat
          .createRecordReader(split.getHadoopInputSplit(), context);
      this.recordReader.initialize(split.getHadoopInputSplit(), context);
    } catch (InterruptedException e) {
      throw new IOException("Could not create RecordReader.", e);
    } finally {
      this.fetched = false;
    }
  }
}

代码示例来源:origin: apache/incubator-gobblin

@Override
public Extractor<S, D> getExtractor(WorkUnitState workUnitState) throws IOException {
 if (!workUnitState.contains(FILE_SPLIT_BYTES_STRING_KEY)) {
  throw new IOException("No serialized FileSplit found in WorkUnitState " + workUnitState.getId());
 }
 Configuration configuration = new Configuration();
 FileInputFormat<K, V> fileInputFormat = getFileInputFormat(workUnitState, configuration);
 String fileSplitBytesStr = workUnitState.getProp(FILE_SPLIT_BYTES_STRING_KEY);
 FileSplit fileSplit = (FileSplit) HadoopUtils.deserializeFromString(FileSplit.class, fileSplitBytesStr);
 TaskAttemptContext taskAttemptContext =
   getTaskAttemptContext(configuration, DummyTaskAttemptIDFactory.newTaskAttemptID());
 try {
  RecordReader<K, V> recordReader = fileInputFormat.createRecordReader(fileSplit, taskAttemptContext);
  recordReader.initialize(fileSplit, taskAttemptContext);
  boolean readKeys = workUnitState.getPropAsBoolean(FILE_INPUT_READ_KEYS_KEY, DEFAULT_FILE_INPUT_READ_KEYS);
  return getExtractor(workUnitState, recordReader, fileSplit, readKeys);
 } catch (InterruptedException ie) {
  throw new IOException(ie);
 }
}

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

recordReader = createRecordReader(tableSplit, tac);
try {
 recordReader.initialize(tableSplit, tac);
} catch (InterruptedException e) {

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

try {
 realReader = newInputFormat.createRecordReader(split, taskContext);
 realReader.initialize(split, taskContext);

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

@Override
public Iterator<HCatRecord> read() throws HCatException {
 HCatInputFormat inpFmt = new HCatInputFormat();
 RecordReader<WritableComparable, HCatRecord> rr;
 try {
  TaskAttemptContext cntxt = ShimLoader.getHadoopShims().getHCatShim().createTaskAttemptContext(conf, new TaskAttemptID());
  rr = inpFmt.createRecordReader(split, cntxt);
  rr.initialize(split, cntxt);
 } catch (IOException e) {
  throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED, e);
 } catch (InterruptedException e) {
  throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED, e);
 }
 return new HCatRecordItr(rr);
}

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

try {
 realReader = newInputFormat.createRecordReader(split, taskContext);
 realReader.initialize(split, taskContext);

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

new TaskAttemptID());
RecordReader<LongWritable, BytesRefArrayWritable> rr = inputFormat.createRecordReader(splits.get(i), tac);
rr.initialize(splits.get(i), tac);
while (rr.nextKeyValue()) {
 readCount++;

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

reader.initialize(nativeSplit, hadoopCtx);

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

recordReader.initialize(inputSplit, context);

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

@Override
public RecordReader<NullWritable, VertexWritable> createRecordReader(final InputSplit split, final TaskAttemptContext context) throws IOException, InterruptedException {
  RecordReader<NullWritable, VertexWritable> reader = new ScriptRecordReader();
  reader.initialize(split, context);
  return reader;
}

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

@Override
public RecordReader<NullWritable, VertexWritable> createRecordReader(final InputSplit split, final TaskAttemptContext context) throws IOException, InterruptedException {
  RecordReader<NullWritable, VertexWritable> reader = new GraphSONRecordReader();
  reader.initialize(split, context);
  return reader;
}

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

@Override
public RecordReader<NullWritable, VertexWritable> createRecordReader(final InputSplit split, final TaskAttemptContext context) throws IOException, InterruptedException {
  final RecordReader<NullWritable, VertexWritable> reader = new GryoRecordReader();
  reader.initialize(split, context);
  return reader;
}

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

recordReader.initialize(inputSplit, context);

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

RecordReader<ImmutableBytesWritable, Result> rr =
  tsif.createRecordReader(split, taskAttemptContext);
rr.initialize(split, taskAttemptContext);

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

@Override
public void initialize(final InputSplit inputSplit, final TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
  final Configuration configuration = taskAttemptContext.getConfiguration();
  final InputFormat<NullWritable, VertexWritable> inputFormat = ReflectionUtils.newInstance(configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_READER, InputFormat.class, InputFormat.class), configuration);
  if (!(inputFormat instanceof GraphFilterAware) && configuration.get(Constants.GREMLIN_HADOOP_GRAPH_FILTER, null) != null)
    this.graphFilter = VertexProgramHelper.deserialize(ConfUtil.makeApacheConfiguration(configuration), Constants.GREMLIN_HADOOP_GRAPH_FILTER);
  this.recordReader = inputFormat.createRecordReader(inputSplit, taskAttemptContext);
  this.recordReader.initialize(inputSplit, taskAttemptContext);
}

代码示例来源:origin: larsgeorge/hbase-book

job.getConfiguration(), new TaskAttemptID());
RecordReader<K, V> reader = inf.createRecordReader(splits.get(i), samplingContext);
reader.initialize(splits.get(i), samplingContext);
while (reader.nextKeyValue()) {
 if (r.nextDouble() <= freq) {

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public RecordReader<Writable, Writable> createRecordReader(
    InputSplit split, TaskAttemptContext context) throws IOException,
    InterruptedException {
  RecordReader<Writable, Writable> recordReader = 
   new ZIPRecordReader();
  recordReader.initialize(split, context);
  return recordReader;
}

代码示例来源:origin: kite-sdk/kite

@Override
public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext)
  throws IOException, InterruptedException {
 // clean up the current wrapped reader, if present
 if (delegate != null) {
  delegate.close();
 }
 this.delegate = inputFormat.createRecordReader(inputSplit, taskAttemptContext);
 delegate.initialize(inputSplit, taskAttemptContext);
}

相关文章