Davis-Zhang-Onehouse commented on code in PR #13489:
URL: https://github.com/apache/hudi/pull/13489#discussion_r2178350839
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -145,20 +172,38 @@ public static Builder newBuilder() {
return new Builder();
}
+ /**
+ * Create a new Builder pre-populated with values from this instance.
+ */
+ public Builder toBuilder() {
+ Builder builder = new Builder();
+ builder.withIndexName(this.indexName)
+ .withIndexType(this.indexType)
+ .withIndexFunction(this.indexFunction)
+ .withSourceFields(new ArrayList<>(this.sourceFields))
+ .withIndexOptions(new HashMap<>(this.indexOptions))
+ .withVersion(this.version);
+ return builder;
+ }
+
public static class Builder {
private String indexName;
private String indexType;
private String indexFunction;
private List<String> sourceFields;
private Map<String, String> indexOptions;
+ private HoodieIndexVersion version;
public Builder() {
this.sourceFields = new ArrayList<>();
this.indexOptions = new HashMap<>();
+ this.version = null;
}
public Builder withIndexName(String indexName) {
+ // Validate the index name belongs to a valid partition path. Function
throws exception if it is a random index name.
+ MetadataPartitionType.fromPartitionPath(indexName);
Review Comment:
fromPartitionPath will throw instead of returning null for
ValidationUtils.checkArgument. I don't have strong opinions here as it's a
small function which may not worth further code refactor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]