Package co.cask.cdap.internal.app.runtime.batch.dataset

Examples of co.cask.cdap.internal.app.runtime.batch.dataset.DataSetInputSplit


  @Override
  public void initialize(final InputSplit split, final TaskAttemptContext context) throws IOException,
    InterruptedException {
    LoggingContextAccessor.setLoggingContext(this.context.getLoggingContext());
    DataSetInputSplit inputSplit = (DataSetInputSplit) split;
    splitReader.initialize(inputSplit.getSplit());
  }
View Full Code Here


  public List<InputSplit> getSplits(final JobContext context) throws IOException, InterruptedException {
    SparkContextConfig sparkContextConfig = new SparkContextConfig(context.getConfiguration());
    List<Split> splits = sparkContextConfig.getInputSelection();
    List<InputSplit> list = new ArrayList<InputSplit>();
    for (Split split : splits) {
      list.add(new DataSetInputSplit(split));
    }
    return list;
  }
View Full Code Here

  @Override
  public RecordReader<KEY, VALUE> createRecordReader(final InputSplit split,
                                                     final TaskAttemptContext context)
    throws IOException, InterruptedException {

    DataSetInputSplit inputSplit = (DataSetInputSplit) split;

    Configuration conf = context.getConfiguration();
    SparkContextProvider contextProvider = new SparkContextProvider(context.getConfiguration());
    BasicSparkContext sparkContext = contextProvider.get();
    //TODO: Metrics should be started here when implemented
    String dataSetName = getInputName(conf);
    BatchReadable<KEY, VALUE> inputDataset = (BatchReadable<KEY, VALUE>) sparkContext.getDataSet(dataSetName);
    SplitReader<KEY, VALUE> splitReader = inputDataset.createSplitReader(inputSplit.getSplit());

    // the record reader now owns the context and will close it
    return new DatasetRecordReader<KEY, VALUE>(splitReader, sparkContext, dataSetName);
  }
View Full Code Here

TOP

Related Classes of co.cask.cdap.internal.app.runtime.batch.dataset.DataSetInputSplit

Copyright © 2018 www.massapicom. 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.