当前位置: 首页>>代码示例>>Java>>正文


Java MRReader类代码示例

本文整理汇总了Java中org.apache.tez.mapreduce.lib.MRReader的典型用法代码示例。如果您正苦于以下问题:Java MRReader类的具体用法?Java MRReader怎么用?Java MRReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MRReader类属于org.apache.tez.mapreduce.lib包,在下文中一共展示了MRReader类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachInputs

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
@Override
public void attachInputs(Map<String, LogicalInput> inputs,
        Configuration conf)
        throws ExecException {
    this.conf = conf;
    LogicalInput logInput = inputs.get(inputKey);
    if (logInput == null || !(logInput instanceof MRInput)) {
        throw new ExecException("POSimpleTezLoad only accepts MRInputs");
    }
    input = (MRInput) logInput;
    try {
        reader = input.getReader();
        // Set split index, MergeCoGroup need it. And this input is the only input of the
        // MergeCoGroup vertex.
        if (reader instanceof MRReader) {
            int splitIndex = ((PigSplit)((MRReader)reader).getSplit()).getSplitIndex();
            PigMapReduce.sJobContext.getConfiguration().setInt(PigImplConstants.PIG_SPLIT_INDEX, splitIndex);
        }
    } catch (IOException e) {
        throw new ExecException(e);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:23,代码来源:POSimpleTezLoad.java

示例2: getKeyValueReaders

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
public Collection<KeyValueReader> getKeyValueReaders() throws InterruptedException, IOException {
  lock.lock();
  try {
    while (eventCount.get() != getNumPhysicalInputs()) {
      condition.await();
    }
  } finally {
    lock.unlock();
  }
  return Collections
      .unmodifiableCollection(Lists.transform(readers, new Function<MRReader, KeyValueReader>() {
        @Override
        public KeyValueReader apply(MRReader input) {
          return input;
        }
      }));
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:18,代码来源:MultiMRInput.java

示例3: handleEvents

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
@Override
public void handleEvents(List<Event> inputEvents) throws Exception {
  lock.lock();
  try {
    Preconditions.checkState(eventCount.get() + inputEvents.size() <= getNumPhysicalInputs(),
        "Unexpected event. All physical sources already initialized");
    for (Event event : inputEvents) {
      MRReader reader = initFromEvent((RootInputDataInformationEvent) event);
      readers.add(reader);
      if (eventCount.incrementAndGet() == getNumPhysicalInputs()) {
        getContext().inputIsReady();
        condition.signal();
      }
    }
  } finally {
    lock.unlock();
  }
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:19,代码来源:MultiMRInput.java

示例4: handleEvents

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
@Override
public void handleEvents(List<Event> inputEvents) throws Exception {
  lock.lock();
  try {
    if (getNumPhysicalInputs() == 0) {
      throw new IllegalStateException(
          "Unexpected event. MultiMRInput has been setup to receive 0 events");
    }
    Preconditions.checkState(eventCount.get() + inputEvents.size() <= getNumPhysicalInputs(),
        "Unexpected event. All physical sources already initialized");
    for (Event event : inputEvents) {
      MRReader reader = initFromEvent((InputDataInformationEvent) event);
      readers.add(reader);
      if (eventCount.incrementAndGet() == getNumPhysicalInputs()) {
        getContext().inputIsReady();
        condition.signal();
      }
    }
  } finally {
    lock.unlock();
  }
}
 
开发者ID:apache,项目名称:tez,代码行数:23,代码来源:MultiMRInput.java

示例5: initFromEvent

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
private MRReader initFromEvent(RootInputDataInformationEvent event) throws IOException {
  Preconditions.checkState(event != null, "Event must be specified");
  LOG.info("Initializing Reader: " + eventCount.get());
  MRSplitProto splitProto = MRSplitProto.parseFrom(event.getUserPayload());
  Object split = null;
  MRReader reader = null;
  JobConf localJobConf = new JobConf(jobConf);
  if (useNewApi) {
    split = MRInputUtils.getNewSplitDetailsFromEvent(splitProto, localJobConf);
    reader = new MRReaderMapReduce(localJobConf, (org.apache.hadoop.mapreduce.InputSplit) split,
        getContext().getCounters(), inputRecordCounter, getContext().getApplicationId()
        .getClusterTimestamp(), getContext().getTaskVertexIndex(), getContext()
        .getApplicationId().getId(), getContext().getTaskIndex(), getContext()
        .getTaskAttemptNumber());
    LOG.info("Split Details -> SplitClass: " + split.getClass().getName() + ", NewSplit: "
        + split);

  } else {
    split = MRInputUtils.getOldSplitDetailsFromEvent(splitProto, localJobConf);
    reader = new MRReaderMapred(localJobConf, (org.apache.hadoop.mapred.InputSplit) split,
        getContext().getCounters(), inputRecordCounter);
    LOG.info("Split Details -> SplitClass: " + split.getClass().getName() + ", OldSplit: "
        + split);
  }
  LOG.info("Initialized RecordReader from event");
  return reader;
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:28,代码来源:MultiMRInput.java

示例6: close

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
@Override
public List<Event> close() throws Exception {
  for (MRReader reader : readers) {
    reader.close();
  }
  return null;
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:8,代码来源:MultiMRInput.java

示例7: close

import org.apache.tez.mapreduce.lib.MRReader; //导入依赖的package包/类
@Override
public List<Event> close() throws Exception {
  for (MRReader reader : readers) {
    reader.close();
  }
  long inputRecords = getContext().getCounters()
      .findCounter(TaskCounter.INPUT_RECORDS_PROCESSED).getValue();
  getContext().getStatisticsReporter().reportItemsProcessed(inputRecords);

  return null;
}
 
开发者ID:apache,项目名称:tez,代码行数:12,代码来源:MultiMRInput.java


注:本文中的org.apache.tez.mapreduce.lib.MRReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。