Keep non-conflicting names for common configs between DataSourceOptions and HoodieWriteConfig (#3511)
This commit is contained in:
@@ -84,7 +84,7 @@ public class HoodieWriteConfig extends HoodieConfig {
|
||||
.noDefaultValue()
|
||||
.withDocumentation("Table name that will be used for registering with metastores like HMS. Needs to be same across runs.");
|
||||
|
||||
public static final ConfigProperty<String> PRECOMBINE_FIELD = ConfigProperty
|
||||
public static final ConfigProperty<String> PRECOMBINE_FIELD_NAME = ConfigProperty
|
||||
.key("hoodie.datasource.write.precombine.field")
|
||||
.defaultValue("ts")
|
||||
.withDocumentation("Field used in preCombining before actual write. When two records have the same key value, "
|
||||
@@ -423,10 +423,10 @@ public class HoodieWriteConfig extends HoodieConfig {
|
||||
@Deprecated
|
||||
public static final String TABLE_NAME = TBL_NAME.key();
|
||||
/**
|
||||
* @deprecated Use {@link #PRECOMBINE_FIELD} and its methods instead
|
||||
* @deprecated Use {@link #PRECOMBINE_FIELD_NAME} and its methods instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PRECOMBINE_FIELD_PROP = PRECOMBINE_FIELD.key();
|
||||
public static final String PRECOMBINE_FIELD_PROP = PRECOMBINE_FIELD_NAME.key();
|
||||
/**
|
||||
* @deprecated Use {@link #WRITE_PAYLOAD_CLASS_NAME} and its methods instead
|
||||
*/
|
||||
@@ -859,7 +859,7 @@ public class HoodieWriteConfig extends HoodieConfig {
|
||||
}
|
||||
|
||||
public String getPreCombineField() {
|
||||
return getString(PRECOMBINE_FIELD);
|
||||
return getString(PRECOMBINE_FIELD_NAME);
|
||||
}
|
||||
|
||||
public String getWritePayloadClass() {
|
||||
@@ -1803,7 +1803,7 @@ public class HoodieWriteConfig extends HoodieConfig {
|
||||
}
|
||||
|
||||
public Builder withPreCombineField(String preCombineField) {
|
||||
writeConfig.setValue(PRECOMBINE_FIELD, preCombineField);
|
||||
writeConfig.setValue(PRECOMBINE_FIELD_NAME, preCombineField);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ public class ComplexAvroKeyGenerator extends BaseKeyGenerator {
|
||||
|
||||
public ComplexAvroKeyGenerator(TypedProperties props) {
|
||||
super(props);
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key())
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key())
|
||||
.split(",")).map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
this.partitionPathFields = Arrays.stream(props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD.key())
|
||||
this.partitionPathFields = Arrays.stream(props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key())
|
||||
.split(",")).map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ public class CustomAvroKeyGenerator extends BaseKeyGenerator {
|
||||
|
||||
public CustomAvroKeyGenerator(TypedProperties props) {
|
||||
super(props);
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key()).split(",")).map(String::trim).collect(Collectors.toList());
|
||||
this.partitionPathFields = Arrays.stream(props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD.key()).split(",")).map(String::trim).collect(Collectors.toList());
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()).split(",")).map(String::trim).collect(Collectors.toList());
|
||||
this.partitionPathFields = Arrays.stream(props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key()).split(",")).map(String::trim).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class GlobalAvroDeleteKeyGenerator extends BaseKeyGenerator {
|
||||
|
||||
public GlobalAvroDeleteKeyGenerator(TypedProperties config) {
|
||||
super(config);
|
||||
this.recordKeyFields = Arrays.asList(config.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key()).split(","));
|
||||
this.recordKeyFields = Arrays.asList(config.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()).split(","));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NonpartitionedAvroKeyGenerator extends BaseKeyGenerator {
|
||||
|
||||
public NonpartitionedAvroKeyGenerator(TypedProperties props) {
|
||||
super(props);
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key())
|
||||
this.recordKeyFields = Arrays.stream(props.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key())
|
||||
.split(",")).map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
this.partitionPathFields = EMPTY_PARTITION_FIELD_LIST;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ import java.util.Collections;
|
||||
public class SimpleAvroKeyGenerator extends BaseKeyGenerator {
|
||||
|
||||
public SimpleAvroKeyGenerator(TypedProperties props) {
|
||||
this(props, props.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key()),
|
||||
props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD.key()));
|
||||
this(props, props.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()),
|
||||
props.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key()));
|
||||
}
|
||||
|
||||
SimpleAvroKeyGenerator(TypedProperties props, String partitionPathField) {
|
||||
|
||||
@@ -88,8 +88,8 @@ public class TimestampBasedAvroKeyGenerator extends SimpleAvroKeyGenerator {
|
||||
}
|
||||
|
||||
public TimestampBasedAvroKeyGenerator(TypedProperties config) throws IOException {
|
||||
this(config, config.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key()),
|
||||
config.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD.key()));
|
||||
this(config, config.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()),
|
||||
config.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key()));
|
||||
}
|
||||
|
||||
TimestampBasedAvroKeyGenerator(TypedProperties config, String partitionPathField) throws IOException {
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract class BaseOneToTwoUpgradeHandler implements UpgradeHandler {
|
||||
public Map<ConfigProperty, String> upgrade(HoodieWriteConfig config, HoodieEngineContext context, String instantTime) {
|
||||
Map<ConfigProperty, String> tablePropsToAdd = new HashMap<>();
|
||||
tablePropsToAdd.put(HoodieTableConfig.PARTITION_FIELDS, getPartitionColumns(config));
|
||||
tablePropsToAdd.put(HoodieTableConfig.RECORDKEY_FIELDS, config.getString(KeyGeneratorOptions.RECORDKEY_FIELD.key()));
|
||||
tablePropsToAdd.put(HoodieTableConfig.RECORDKEY_FIELDS, config.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()));
|
||||
tablePropsToAdd.put(HoodieTableConfig.BASE_FILE_FORMAT, config.getString(HoodieTableConfig.BASE_FILE_FORMAT));
|
||||
return tablePropsToAdd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user