use of io.cdap.cdap.etl.api.StageConfigurer in project cdap by caskdata.
the class FieldsPrefixTransform method configurePipeline.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
try {
Schema outSchema = config.getOutputSchema(Schema.parseJson(config.schemaStr));
stageConfigurer.setOutputSchema(outSchema);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid output schema: " + e.getMessage(), e);
}
}
use of io.cdap.cdap.etl.api.StageConfigurer in project cdap by caskdata.
the class IntValueFilterTransform method configurePipeline.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
use of io.cdap.cdap.etl.api.StageConfigurer in project cdap by caskdata.
the class DropNullTransform method configurePipeline.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
Schema inputSchema = stageConfigurer.getInputSchema();
if (inputSchema != null) {
stageConfigurer.setOutputSchema(getOutputSchema(inputSchema));
}
}
use of io.cdap.cdap.etl.api.StageConfigurer in project cdap by caskdata.
the class IdentityTransform method configurePipeline.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
use of io.cdap.cdap.etl.api.StageConfigurer in project cdap by caskdata.
the class StringValueFilterTransform method configurePipeline.
@Override
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer();
Schema inputSchema = stageConfigurer.getInputSchema();
FailureCollector collector = stageConfigurer.getFailureCollector();
if (inputSchema != null && !config.containsMacro("field")) {
Schema.Field field = inputSchema.getField(config.field);
if (field == null) {
collector.addFailure(String.format("'%s' is not a field in the input schema.", config.field), "Make sure field is present in the input schema.").withConfigProperty("field");
collector.getOrThrowException();
}
Schema fieldSchema = field.getSchema();
Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType();
if (fieldType != Schema.Type.STRING) {
collector.addFailure(String.format("'%s' is of type '%s' instead of a string.", config.field, fieldType), "Make sure provided field is of type string.").withConfigProperty("field").withInputSchemaField(config.field);
}
}
stageConfigurer.setOutputSchema(stageConfigurer.getInputSchema());
}
Aggregations