hudi-agent commented on code in PR #17825:
URL: https://github.com/apache/hudi/pull/17825#discussion_r3346346491


##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieReaderContext.java:
##########
@@ -77,28 +81,53 @@
  *            and {@code RowData} in Flink.
  */
 public abstract class HoodieReaderContext<T> {
+
+  @Getter
   private final StorageConfiguration<?> storageConfiguration;
   protected final HoodieFileFormat baseFileFormat;
   // For general predicate pushdown.
+  @Getter
   protected final Option<Predicate> keyFilterOpt;
   protected final HoodieTableConfig tableConfig;
+  @Setter
   private String tablePath = null;
+  @Getter
+  @Setter
   private String latestCommitTime = null;
+  @Getter
+  @Setter
   private Option<HoodieRecordMerger> recordMerger = null;
+  @Getter
+  @Setter
   private Boolean hasLogFiles = null;
+  @Getter
+  @Setter
   private Boolean hasBootstrapBaseFile = null;
+  @Getter
+  @Setter
   private Boolean needsBootstrapMerge = null;
 
+  @Getter
+  @Setter
   // should we do position based merging for mor
   private Boolean shouldMergeUseRecordPosition = null;
   protected Option<InstantRange> instantRangeOpt;
+  @Getter
   private RecordMergeMode mergeMode;
+  @Getter
   protected RecordContext<T> recordContext;
+  @Getter
+  @Setter
   private FileGroupReaderSchemaHandler<T> schemaHandler = null;
   // the default iterator mode is engine-specific record mode
+  @Setter
   private IteratorMode iteratorMode = IteratorMode.ENGINE_RECORD;
+  @Getter
   protected final HoodieConfig hoodieReaderConfig;
-  private boolean enableLogicalTimestampFieldRepair = true;
+  @Getter

Review Comment:
   🤖 nit: `@Accessors(fluent = true)` on this single field makes it the only 
one in the class that doesn't use `get`/`set` naming — every other field here 
uses standard accessor prefixes. A future caller has no way to know that this 
flag needs `readerContext.enableLogicalTimestampFieldRepair(true)` while 
everything else uses `readerContext.setXxx(...)`. Could you drop the fluent 
annotation and use a straightforward `@Getter`/`@Setter` (which would generate 
`isEnableLogicalTimestampFieldRepair()` / 
`setEnableLogicalTimestampFieldRepair(...)`)? Renaming to 
`logicalTimestampFieldRepairEnabled` might also read more naturally.
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-common/src/main/java/org/apache/hudi/common/HoodieCleanStat.java:
##########
@@ -19,207 +19,45 @@
 package org.apache.hudi.common;
 
 import org.apache.hudi.common.model.HoodieCleaningPolicy;
-import org.apache.hudi.common.table.timeline.HoodieInstant;
 import org.apache.hudi.common.util.CollectionUtils;
-import org.apache.hudi.common.util.Option;
+
+import lombok.Builder;
+import lombok.Value;
 
 import java.io.Serializable;
 import java.util.List;
 
 /**
  * Collects stats about a single partition clean operation.
  */
+@Builder(setterPrefix = "with")
+@Value
 public class HoodieCleanStat implements Serializable {
 
   // Policy used
-  private final HoodieCleaningPolicy policy;
+  HoodieCleaningPolicy policy;
   // Partition path cleaned
-  private final String partitionPath;
+  String partitionPath;
   // The patterns that were generated for the delete operation
-  private final List<String> deletePathPatterns;
-  private final List<String> successDeleteFiles;
-  // Files that could not be deleted
-  private final List<String> failedDeleteFiles;
-  // Bootstrap Base Path patterns that were generated for the delete operation
-  private final List<String> deleteBootstrapBasePathPatterns;
-  private final List<String> successDeleteBootstrapBaseFiles;
+  @Builder.Default
+  List<String> deletePathPatterns = CollectionUtils.createImmutableList();
+  @Builder.Default
+  List<String> successDeleteFiles = CollectionUtils.createImmutableList();
   // Files that could not be deleted
-  private final List<String> failedDeleteBootstrapBaseFiles;
+  @Builder.Default
+  List<String> failedDeleteFiles = CollectionUtils.createImmutableList();
   // Earliest commit that was retained in this clean
-  private final String earliestCommitToRetain;
+  String earliestCommitToRetain;
   // Last completed commit timestamp before clean
-  private final String lastCompletedCommitTimestamp;
+  String lastCompletedCommitTimestamp;
+  // Bootstrap Base Path patterns that were generated for the delete operation
+  @Builder.Default
+  List<String> deleteBootstrapBasePathPatterns = 
CollectionUtils.createImmutableList();
+  @Builder.Default
+  List<String> successDeleteBootstrapBaseFiles = 
CollectionUtils.createImmutableList();
+  // Files that could not be deleted
+  @Builder.Default
+  List<String> failedDeleteBootstrapBaseFiles = 
CollectionUtils.createImmutableList();
   // set to true if partition is deleted
-  private final boolean isPartitionDeleted;
-
-  public HoodieCleanStat(HoodieCleaningPolicy policy, String partitionPath, 
List<String> deletePathPatterns,
-      List<String> successDeleteFiles, List<String> failedDeleteFiles, String 
earliestCommitToRetain,String lastCompletedCommitTimestamp) {
-    this(policy, partitionPath, deletePathPatterns, successDeleteFiles, 
failedDeleteFiles, earliestCommitToRetain,
-        lastCompletedCommitTimestamp, CollectionUtils.createImmutableList(), 
CollectionUtils.createImmutableList(),
-        CollectionUtils.createImmutableList(), false);
-  }
-
-  public HoodieCleanStat(HoodieCleaningPolicy policy, String partitionPath, 
List<String> deletePathPatterns,
-                         List<String> successDeleteFiles, List<String> 
failedDeleteFiles,
-                         String earliestCommitToRetain,String 
lastCompletedCommitTimestamp,
-                         List<String> deleteBootstrapBasePathPatterns,
-                         List<String> successDeleteBootstrapBaseFiles,
-                         List<String> failedDeleteBootstrapBaseFiles,
-                         boolean isPartitionDeleted) {
-    this.policy = policy;
-    this.partitionPath = partitionPath;
-    this.deletePathPatterns = deletePathPatterns;
-    this.successDeleteFiles = successDeleteFiles;
-    this.failedDeleteFiles = failedDeleteFiles;
-    this.earliestCommitToRetain = earliestCommitToRetain;
-    this.lastCompletedCommitTimestamp = lastCompletedCommitTimestamp;
-    this.deleteBootstrapBasePathPatterns = deleteBootstrapBasePathPatterns;
-    this.successDeleteBootstrapBaseFiles = successDeleteBootstrapBaseFiles;
-    this.failedDeleteBootstrapBaseFiles = failedDeleteBootstrapBaseFiles;
-    this.isPartitionDeleted = isPartitionDeleted;
-  }
-
-  public HoodieCleaningPolicy getPolicy() {
-    return policy;
-  }
-
-  public String getPartitionPath() {
-    return partitionPath;
-  }
-
-  public List<String> getDeletePathPatterns() {
-    return deletePathPatterns;
-  }
-
-  public List<String> getSuccessDeleteFiles() {
-    return successDeleteFiles;
-  }
-
-  public List<String> getFailedDeleteFiles() {
-    return failedDeleteFiles;
-  }
-
-  public List<String> getDeleteBootstrapBasePathPatterns() {
-    return deleteBootstrapBasePathPatterns;
-  }
-
-  public List<String> getSuccessDeleteBootstrapBaseFiles() {
-    return successDeleteBootstrapBaseFiles;
-  }
-
-  public List<String> getFailedDeleteBootstrapBaseFiles() {
-    return failedDeleteBootstrapBaseFiles;
-  }
-
-  public String getEarliestCommitToRetain() {
-    return earliestCommitToRetain;
-  }
-
-  public String getLastCompletedCommitTimestamp() {
-    return lastCompletedCommitTimestamp;
-  }
-
-  public boolean isPartitionDeleted() {
-    return isPartitionDeleted;
-  }
-
-  public static Builder newBuilder() {
-    return new Builder();
-  }
-
-  /**
-   * A builder used to build {@link HoodieCleanStat}.
-   */
-  public static class Builder {
-
-    private HoodieCleaningPolicy policy;
-    private List<String> deletePathPatterns;
-    private List<String> successDeleteFiles;
-    private List<String> failedDeleteFiles;
-    private String partitionPath;
-    private String earliestCommitToRetain;
-    private String lastCompletedCommitTimestamp;
-    private List<String> deleteBootstrapBasePathPatterns;
-    private List<String> successDeleteBootstrapBaseFiles;
-    private List<String> failedDeleteBootstrapBaseFiles;
-    private boolean isPartitionDeleted;
-
-    public Builder withPolicy(HoodieCleaningPolicy policy) {
-      this.policy = policy;
-      return this;
-    }
-
-    public Builder withDeletePathPattern(List<String> deletePathPatterns) {
-      this.deletePathPatterns = deletePathPatterns;
-      return this;
-    }
-
-    public Builder withSuccessfulDeletes(List<String> successDeleteFiles) {
-      this.successDeleteFiles = successDeleteFiles;
-      return this;
-    }
-
-    public Builder withFailedDeletes(List<String> failedDeleteFiles) {
-      this.failedDeleteFiles = failedDeleteFiles;
-      return this;
-    }
-
-    public Builder withDeleteBootstrapBasePathPatterns(List<String> 
deletePathPatterns) {
-      this.deleteBootstrapBasePathPatterns = deletePathPatterns;
-      return this;
-    }
-
-    public Builder withSuccessfulDeleteBootstrapBaseFiles(List<String> 
successDeleteFiles) {
-      this.successDeleteBootstrapBaseFiles = successDeleteFiles;
-      return this;
-    }
-
-    public Builder withFailedDeleteBootstrapBaseFiles(List<String> 
failedDeleteFiles) {
-      this.failedDeleteBootstrapBaseFiles = failedDeleteFiles;
-      return this;
-    }
-
-    public Builder withPartitionPath(String partitionPath) {
-      this.partitionPath = partitionPath;
-      return this;
-    }
-
-    public Builder withEarliestCommitRetained(Option<HoodieInstant> 
earliestCommitToRetain) {
-      this.earliestCommitToRetain =
-          (earliestCommitToRetain.isPresent()) ? 
earliestCommitToRetain.get().requestedTime() : "";
-      return this;
-    }
-
-    public Builder withLastCompletedCommitTimestamp(String 
lastCompletedCommitTimestamp) {
-      this.lastCompletedCommitTimestamp = lastCompletedCommitTimestamp;
-      return this;
-    }
-
-    public Builder isPartitionDeleted(boolean isPartitionDeleted) {
-      this.isPartitionDeleted = isPartitionDeleted;
-      return this;
-    }
-
-    public HoodieCleanStat build() {
-      return new HoodieCleanStat(policy, partitionPath, deletePathPatterns, 
successDeleteFiles, failedDeleteFiles,
-          earliestCommitToRetain, lastCompletedCommitTimestamp, 
deleteBootstrapBasePathPatterns,
-        successDeleteBootstrapBaseFiles, failedDeleteBootstrapBaseFiles, 
isPartitionDeleted);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return "HoodieCleanStat{"
-        + "policy=" + policy
-        + ", partitionPath='" + partitionPath + '\''
-        + ", deletePathPatterns=" + deletePathPatterns
-        + ", successDeleteFiles=" + successDeleteFiles
-        + ", failedDeleteFiles=" + failedDeleteFiles
-        + ", earliestCommitToRetain='" + earliestCommitToRetain
-        + ", deleteBootstrapBasePathPatterns=" + 
deleteBootstrapBasePathPatterns
-        + ", successDeleteBootstrapBaseFiles=" + 
successDeleteBootstrapBaseFiles
-        + ", failedDeleteBootstrapBaseFiles=" + failedDeleteBootstrapBaseFiles
-        + ", isPartitionDeleted=" + isPartitionDeleted + '\''
-        + '}';
-  }
+  boolean isPartitionDeleted;

Review Comment:
   🤖 nit: the `is` prefix on the field name causes Lombok to generate the 
builder method as `.withIsPartitionDeleted(...)`, which is a bit of a mouthful. 
Could you rename the field to `partitionDeleted`? Lombok will still generate 
`isPartitionDeleted()` as the getter (it applies the `is` prefix automatically 
for booleans), and the builder method becomes the cleaner 
`.withPartitionDeleted(...)`.
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



-- 
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]

Reply via email to