Search in sources :

Example 6 with StageConfigurer

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

the class StringCaseTransform method configurePipeline.

// configurePipeline is called only once, when the pipeline is deployed. Static validation should be done here.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
    StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
    // the output schema is always the same as the input schema
    Schema inputSchema = stageConfigurer.getInputSchema();
    // if schema is null, that means it is either not known until runtime, or it is variable
    if (inputSchema != null) {
        // if the input schema is constant and known at configure time, check that all configured fields are strings
        for (String fieldName : config.getUpperFields()) {
            validateFieldIsString(inputSchema, fieldName);
        }
        for (String fieldName : config.getLowerFields()) {
            validateFieldIsString(inputSchema, fieldName);
        }
    }
    stageConfigurer.setOutputSchema(inputSchema);
}
Also used : StageConfigurer(co.cask.cdap.etl.api.StageConfigurer) Schema(co.cask.cdap.api.data.schema.Schema)

Example 7 with StageConfigurer

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

the class GroupFilterAggregator method configurePipeline.

@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException {
    StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
    Schema inputSchema = stageConfigurer.getInputSchema();
    if (inputSchema == null) {
        return;
    }
    Schema.Field groupField = inputSchema.getField(config.field);
    if (groupField == null) {
        throw new IllegalArgumentException(config.field + " is not in the input schema");
    }
    Schema groupSchema = groupField.getSchema();
    Schema.Type groupType = groupSchema.isNullable() ? groupSchema.getNonNullable().getType() : groupSchema.getType();
    if (groupType != Schema.Type.STRING) {
        throw new IllegalArgumentException(config.field + " is not of type string");
    }
    stageConfigurer.setOutputSchema(inputSchema);
}
Also used : StageConfigurer(co.cask.cdap.etl.api.StageConfigurer) Schema(co.cask.cdap.api.data.schema.Schema)

Example 8 with StageConfigurer

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

the class IdentityAggregator method configurePipeline.

@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException {
    StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
    stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
Also used : StageConfigurer(co.cask.cdap.etl.api.StageConfigurer)

Example 9 with StageConfigurer

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

the class StringValueFilterTransform method configurePipeline.

@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException {
    StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
    stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
Also used : StageConfigurer(co.cask.cdap.etl.api.StageConfigurer)

Example 10 with StageConfigurer

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

the class FilterErrorTransform method configurePipeline.

@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException {
    StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
    stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
Also used : StageConfigurer(co.cask.cdap.etl.api.StageConfigurer)

Aggregations

StageConfigurer (co.cask.cdap.etl.api.StageConfigurer)15 Schema (co.cask.cdap.api.data.schema.Schema)5