Search in sources :

Example 1 with DatasetInputFormatProvider

use of co.cask.cdap.internal.app.runtime.batch.dataset.DatasetInputFormatProvider in project cdap by caskdata.

the class BasicMapReduceContext method createInput.

private Input.InputFormatProviderInput createInput(Input.DatasetInput datasetInput) {
    String datasetName = datasetInput.getName();
    Map<String, String> datasetArgs = datasetInput.getArguments();
    // keep track of the original alias to set it on the created Input before returning it
    String originalAlias = datasetInput.getAlias();
    Dataset dataset;
    if (datasetInput.getNamespace() == null) {
        dataset = getDataset(datasetName, datasetArgs, AccessType.READ);
    } else {
        dataset = getDataset(datasetInput.getNamespace(), datasetName, datasetArgs, AccessType.READ);
    }
    DatasetInputFormatProvider datasetInputFormatProvider = new DatasetInputFormatProvider(datasetInput.getNamespace(), datasetName, datasetArgs, dataset, datasetInput.getSplits(), MapReduceBatchReadableInputFormat.class);
    return (Input.InputFormatProviderInput) Input.of(datasetName, datasetInputFormatProvider).alias(originalAlias);
}
Also used : DatasetInputFormatProvider(co.cask.cdap.internal.app.runtime.batch.dataset.DatasetInputFormatProvider) Dataset(co.cask.cdap.api.dataset.Dataset)

Aggregations

Dataset (co.cask.cdap.api.dataset.Dataset)1 DatasetInputFormatProvider (co.cask.cdap.internal.app.runtime.batch.dataset.DatasetInputFormatProvider)1