the-other-tim-brown commented on code in PR #13305:
URL: https://github.com/apache/hudi/pull/13305#discussion_r2122080410
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/WriteStatus.java:
##########
@@ -76,10 +78,15 @@ public class WriteStatus implements Serializable {
private final boolean trackSuccessRecords;
private final transient Random random;
- public WriteStatus(Boolean trackSuccessRecords, Double failureFraction) {
+ public WriteStatus(Boolean trackSuccessRecords, Double failureFraction,
Boolean isMetadataTable) {
Review Comment:
can we use primitives here to avoid developers from passing in null for
`Boolean` and getting a runtime NPE?
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieWriteStat.java:
##########
@@ -344,4 +375,18 @@ public void setTotalCreateTime(long totalCreateTime) {
this.totalCreateTime = totalCreateTime;
}
}
+
+ private static Map<String, HoodieColumnRangeMetadata<Comparable>>
mergeRecordsStats(
+ Map<String, HoodieColumnRangeMetadata<Comparable>> stats1,
+ Map<String, HoodieColumnRangeMetadata<Comparable>> stats2) {
+ Map<String, HoodieColumnRangeMetadata<Comparable>> mergedStats = new
HashMap<>(stats1);
+ for (Map.Entry<String, HoodieColumnRangeMetadata<Comparable>> entry :
stats2.entrySet()) {
+ final String colName = entry.getKey();
+ final HoodieColumnRangeMetadata<Comparable> metadata =
mergedStats.containsKey(colName)
+ ? HoodieColumnRangeMetadata.merge(mergedStats.get(colName),
entry.getValue())
+ : entry.getValue();
+ mergedStats.put(colName, metadata);
Review Comment:
This can be simplified to use the
[merge](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#merge-K-V-java.util.function.BiFunction-)
function
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/WriteStatus.java:
##########
@@ -257,9 +273,19 @@ public boolean isTrackingSuccessfulWrites() {
return trackSuccessRecords;
}
+ public void setIsMetadata(boolean isMetadataTable) {
Review Comment:
Can we avoid the setter and make instance variables final?
--
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]