[MINOR] Fix EXTERNAL_RECORD_AND_SCHEMA_TRANSFORMATION config (#3250)
This commit is contained in:
@@ -339,8 +339,9 @@ public class HoodieWriteConfig extends HoodieConfig {
|
||||
.withDocumentation("");
|
||||
|
||||
public static final ConfigProperty<String> EXTERNAL_RECORD_AND_SCHEMA_TRANSFORMATION = ConfigProperty
|
||||
.key(AVRO_SCHEMA + ".externalTransformation")
|
||||
.key(AVRO_SCHEMA.key() + ".external.transformation")
|
||||
.defaultValue("false")
|
||||
.withAlternatives(AVRO_SCHEMA.key() + ".externalTransformation")
|
||||
.withDocumentation("");
|
||||
|
||||
private ConsistencyGuardConfig consistencyGuardConfig;
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.apache.hudi.config.HoodieWriteConfig.Builder;
|
||||
|
||||
import org.apache.hudi.index.HoodieIndex;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -33,16 +35,23 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TestHoodieWriteConfig {
|
||||
|
||||
@Test
|
||||
public void testPropertyLoading() throws IOException {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void testPropertyLoading(boolean withAlternative) throws IOException {
|
||||
Builder builder = HoodieWriteConfig.newBuilder().withPath("/tmp");
|
||||
Map<String, String> params = new HashMap<>(3);
|
||||
params.put(HoodieCompactionConfig.CLEANER_COMMITS_RETAINED_PROP.key(), "1");
|
||||
params.put(HoodieCompactionConfig.MAX_COMMITS_TO_KEEP_PROP.key(), "5");
|
||||
params.put(HoodieCompactionConfig.MIN_COMMITS_TO_KEEP_PROP.key(), "2");
|
||||
if (withAlternative) {
|
||||
params.put("hoodie.avro.schema.externalTransformation", "true");
|
||||
} else {
|
||||
params.put("hoodie.avro.schema.external.transformation", "true");
|
||||
}
|
||||
ByteArrayOutputStream outStream = saveParamsIntoOutputStream(params);
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(outStream.toByteArray());
|
||||
try {
|
||||
@@ -54,6 +63,7 @@ public class TestHoodieWriteConfig {
|
||||
HoodieWriteConfig config = builder.build();
|
||||
assertEquals(5, config.getMaxCommitsToKeep());
|
||||
assertEquals(2, config.getMinCommitsToKeep());
|
||||
assertTrue(config.shouldUseExternalSchemaTransformation());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user