Search in sources :

Example 1 with DeleteSupportSchemaPostProcessor

use of org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor in project hudi by apache.

the class TestSchemaPostProcessor method testDeleteSupport.

@Test
public void testDeleteSupport() {
    DeleteSupportSchemaPostProcessor processor = new DeleteSupportSchemaPostProcessor(properties, null);
    Schema schema = new Schema.Parser().parse(ORIGINAL_SCHEMA);
    Schema targetSchema = processor.processSchema(schema);
    assertNotNull(targetSchema.getField("_hoodie_is_deleted"));
}
Also used : DeleteSupportSchemaPostProcessor(org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor) Schema(org.apache.avro.Schema) Test(org.junit.jupiter.api.Test)

Example 2 with DeleteSupportSchemaPostProcessor

use of org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor in project hudi by apache.

the class TestSchemaPostProcessor method testChainedSchemaPostProcessor.

@Test
public void testChainedSchemaPostProcessor() {
    // DeleteSupportSchemaPostProcessor first, DummySchemaPostProcessor second
    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, "org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor,org.apache.hudi.utilities.DummySchemaPostProcessor");
    SchemaPostProcessor processor = UtilHelpers.createSchemaPostProcessor(properties.getString(Config.SCHEMA_POST_PROCESSOR_PROP), properties, jsc);
    Schema schema = new Schema.Parser().parse(ORIGINAL_SCHEMA);
    Schema targetSchema = processor.processSchema(schema);
    assertNull(targetSchema.getField("_row_key"));
    assertNull(targetSchema.getField("_hoodie_is_deleted"));
    assertNotNull(targetSchema.getField("testString"));
    // DummySchemaPostProcessor first, DeleteSupportSchemaPostProcessor second
    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, "org.apache.hudi.utilities.DummySchemaPostProcessor,org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor");
    processor = UtilHelpers.createSchemaPostProcessor(properties.getString(Config.SCHEMA_POST_PROCESSOR_PROP), properties, jsc);
    schema = new Schema.Parser().parse(ORIGINAL_SCHEMA);
    targetSchema = processor.processSchema(schema);
    assertNull(targetSchema.getField("_row_key"));
    assertNotNull(targetSchema.getField("_hoodie_is_deleted"));
    assertNotNull(targetSchema.getField("testString"));
}
Also used : Schema(org.apache.avro.Schema) DropColumnSchemaPostProcessor(org.apache.hudi.utilities.schema.DropColumnSchemaPostProcessor) DeleteSupportSchemaPostProcessor(org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor) SchemaPostProcessor(org.apache.hudi.utilities.schema.SchemaPostProcessor) Test(org.junit.jupiter.api.Test)

Aggregations

Schema (org.apache.avro.Schema)2 DeleteSupportSchemaPostProcessor (org.apache.hudi.utilities.schema.DeleteSupportSchemaPostProcessor)2 Test (org.junit.jupiter.api.Test)2 DropColumnSchemaPostProcessor (org.apache.hudi.utilities.schema.DropColumnSchemaPostProcessor)1 SchemaPostProcessor (org.apache.hudi.utilities.schema.SchemaPostProcessor)1