Search in sources :

Example 1 with MultiInputStageConfigurer

use of co.cask.cdap.etl.api.MultiInputStageConfigurer in project cdap by caskdata.

the class MockJoiner method configurePipeline.

@Override
public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) {
    MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer();
    Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas();
    stageConfigurer.setOutputSchema(getOutputSchema(inputSchemas));
    config.validateConfig();
}
Also used : Schema(co.cask.cdap.api.data.schema.Schema) MultiInputStageConfigurer(co.cask.cdap.etl.api.MultiInputStageConfigurer)

Example 2 with MultiInputStageConfigurer

use of co.cask.cdap.etl.api.MultiInputStageConfigurer in project cdap by caskdata.

the class DupeFlagger method configurePipeline.

@Override
public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) {
    MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer();
    Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas();
    if (inputSchemas.size() != 2) {
        throw new IllegalArgumentException(String.format("The DupeFlagger plugin must have exactly two inputs with the same schema, but found %d inputs.", inputSchemas.size()));
    }
    Iterator<Schema> schemaIterator = inputSchemas.values().iterator();
    Schema schema1 = schemaIterator.next();
    Schema schema2 = schemaIterator.next();
    if (!schema1.equals(schema2)) {
        throw new IllegalArgumentException("The DupeFlagger plugin must have exactly two inputs with the same schema, " + "but the schemas are not the same.");
    }
    if (!config.containsMacro("keep")) {
        if (!inputSchemas.keySet().contains(config.keep)) {
            throw new IllegalArgumentException(config.keep + " is not an input.");
        }
    }
    if (!config.containsMacro("flagField")) {
        stageConfigurer.setOutputSchema(getOutputSchema(schema1));
    }
}
Also used : Schema(co.cask.cdap.api.data.schema.Schema) MultiInputStageConfigurer(co.cask.cdap.etl.api.MultiInputStageConfigurer)

Aggregations

Schema (co.cask.cdap.api.data.schema.Schema)2 MultiInputStageConfigurer (co.cask.cdap.etl.api.MultiInputStageConfigurer)2