use of org.apache.hudi.utilities.schema.DropColumnSchemaPostProcessor in project hudi by apache.
the class TestSchemaPostProcessor method testDeleteColumn.
@Test
public void testDeleteColumn() {
// remove column ums_id_ from source schema
properties.put(DropColumnSchemaPostProcessor.Config.DELETE_COLUMN_POST_PROCESSOR_COLUMN_PROP, "rider");
DropColumnSchemaPostProcessor processor = new DropColumnSchemaPostProcessor(properties, null);
Schema schema = new Schema.Parser().parse(ORIGINAL_SCHEMA);
Schema targetSchema = processor.processSchema(schema);
assertNull(targetSchema.getField("rider"));
assertNotNull(targetSchema.getField("_row_key"));
}
use of org.apache.hudi.utilities.schema.DropColumnSchemaPostProcessor in project hudi by apache.
the class TestSchemaPostProcessor method testDeleteColumnThrows.
@Test
public void testDeleteColumnThrows() {
// remove all columns from source schema
properties.put(DropColumnSchemaPostProcessor.Config.DELETE_COLUMN_POST_PROCESSOR_COLUMN_PROP, "timestamp,_row_key,rider,driver,fare");
DropColumnSchemaPostProcessor processor = new DropColumnSchemaPostProcessor(properties, null);
Schema schema = new Schema.Parser().parse(ORIGINAL_SCHEMA);
Assertions.assertThrows(HoodieSchemaPostProcessException.class, () -> processor.processSchema(schema));
}
Aggregations