Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); parseConfiguration(config.decompressor); try { Schema outputSchema = Schema.parseJson(config.schema); List<Field> outFields = outputSchema.getFields(); for (Field field : outFields) { outSchemaMap.put(field.getName(), field.getSchema().getType()); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } catch (IOException e) { throw new IllegalArgumentException("Format of schema specified is invalid. Please check the format. " + e.getMessage()); } Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { for (Schema.Field field : inputSchema.getFields()) { if (outSchemaMap.containsKey(field.getName()) && deCompMap.containsKey(field.getName()) && deCompMap.get(field.getName()) != DecompressorType.NONE && !Schema.Type.BYTES.equals(field.getSchema().getType())) { throw new IllegalArgumentException( String.format("Decompression is selected for the input field %s, but the field is of type %s " + "Decompression is supported only for bytes.", field.getName(), field.getSchema().getType().toString())); } } } for (Map.Entry<String, DecompressorType> entry : deCompMap.entrySet()) { if (!outSchemaMap.containsKey(entry.getKey())) { throw new IllegalArgumentException("Field '" + entry.getKey() + "' specified to be decompresed is not " + "present in the output schema. Please add field '" + entry.getKey() + "'" + "to output schema or remove it from decompress"); } if (outSchemaMap.get(entry.getKey()) != Schema.Type.BYTES && outSchemaMap.get(entry.getKey()) != Schema.Type.STRING) { throw new IllegalArgumentException("Field '" + entry.getKey() + "' should be of type BYTES or STRING in " + "output schema."); } } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); parseConfiguration(config.decompressor); try { Schema outputSchema = Schema.parseJson(config.schema); List<Field> outFields = outputSchema.getFields(); for (Field field : outFields) { outSchemaMap.put(field.getName(), field.getSchema().getType()); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } catch (IOException e) { throw new IllegalArgumentException("Format of schema specified is invalid. Please check the format. " + e.getMessage()); } Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { for (Schema.Field field : inputSchema.getFields()) { if (outSchemaMap.containsKey(field.getName()) && deCompMap.containsKey(field.getName()) && deCompMap.get(field.getName()) != DecompressorType.NONE && !Schema.Type.BYTES.equals(field.getSchema().getType())) { throw new IllegalArgumentException( String.format("Decompression is selected for the input field %s, but the field is of type %s. " + "Decompression is supported only for the type Bytes.", field.getName(), field.getSchema().getType().toString())); } } } for (Map.Entry<String, DecompressorType> entry : deCompMap.entrySet()) { if (!outSchemaMap.containsKey(entry.getKey())) { throw new IllegalArgumentException("Field '" + entry.getKey() + "' specified to be decompresed is not " + "present in the output schema. Please add field '" + entry.getKey() + "'" + "to output schema or remove it from decompress"); } if (outSchemaMap.get(entry.getKey()) != Schema.Type.BYTES && outSchemaMap.get(entry.getKey()) != Schema.Type.STRING) { throw new IllegalArgumentException("Field '" + entry.getKey() + "' should be of type BYTES or STRING in " + "output schema."); } } }