@Test public void testKeepDropBothNonNull() { Schema schema = Schema.recordOf("three", Schema.Field.of("x", Schema.of(Schema.Type.INT)), Schema.Field.of("y", Schema.of(Schema.Type.DOUBLE)), Schema.Field.of("z", Schema.arrayOf(Schema.of(Schema.Type.INT)))); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(schema, Collections.emptyMap()); try { ProjectionTransform.ProjectionTransformConfig config = new ProjectionTransform.ProjectionTransformConfig("y, z", null, null, "x,y"); new ProjectionTransform(config).configurePipeline(mockConfigurer); Assert.fail(); } catch (ValidationException e) { Assert.assertEquals(1, e.getFailures().size()); Assert.assertEquals(2, e.getFailures().get(0).getCauses().size()); } }
@Override public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); init(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); collector.getOrThrowException(); Schema outputSchema = null; if (pipelineConfigurer.getStageConfigurer().getInputSchema() != null) { outputSchema = getOutputSchema(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); }
ProjectionTransform extends Transform<StructuredRecord, StructuredRecord> { @Override public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); init(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); collector.getOrThrowException(); Schema outputSchema = null; if (pipelineConfigurer.getStageConfigurer().getInputSchema() != null) { outputSchema = getOutputSchema(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } }
ProjectionTransform extends Transform<StructuredRecord, StructuredRecord> { @Override public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); init(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); collector.getOrThrowException(); Schema outputSchema = null; if (pipelineConfigurer.getStageConfigurer().getInputSchema() != null) { outputSchema = getOutputSchema(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } ProjectionTransform(ProjectionTransformConfig projectionTransformConfig); }
ProjectionTransform extends Transform<StructuredRecord, StructuredRecord> { @Override public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); init(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); collector.getOrThrowException(); Schema outputSchema = null; if (pipelineConfigurer.getStageConfigurer().getInputSchema() != null) { outputSchema = getOutputSchema(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } ProjectionTransform(ProjectionTransformConfig projectionTransformConfig); @Override void configurePipeline(PipelineConfigurer pipelineConfigurer); @Override void initialize(TransformContext context); @Override void prepareRun(StageSubmitterContext context); @Override void transform(StructuredRecord valueIn, Emitter<StructuredRecord> emitter); }
ProjectionTransform extends Transform<StructuredRecord, StructuredRecord> { @Override public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); init(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); collector.getOrThrowException(); Schema outputSchema = null; if (pipelineConfigurer.getStageConfigurer().getInputSchema() != null) { outputSchema = getOutputSchema(pipelineConfigurer.getStageConfigurer().getInputSchema(), collector); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } ProjectionTransform(ProjectionTransformConfig projectionTransformConfig); @Override void configurePipeline(PipelineConfigurer pipelineConfigurer); @Override void initialize(TransformContext context); @Override void prepareRun(StageSubmitterContext context); @Override void transform(StructuredRecord valueIn, Emitter<StructuredRecord> emitter);  }