KnightChess commented on code in PR #11448:
URL: https://github.com/apache/hudi/pull/11448#discussion_r1639092577


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieFileGroupReader.java:
##########
@@ -256,6 +257,137 @@ public static RecordMergeMode 
getRecordMergeMode(Properties props) {
     return RecordMergeMode.valueOf(mergeMode);
   }
 
+  public static Builder builder() {
+    return new Builder<>();
+  }
+
+  public static class Builder<T> {
+
+    HoodieReaderContext<T> readerContext;
+    HoodieStorage storage;
+    String tablePath;
+    String latestCommitTime;
+    FileSlice fileSlice;
+    Schema dataSchema;
+    Schema requestedSchema;
+    Option<InternalSchema> internalSchemaOpt;
+    HoodieTableMetaClient hoodieTableMetaClient;
+    TypedProperties props;
+    HoodieTableConfig tableConfig;
+    long start;
+    long length;
+    boolean shouldUseRecordPosition = false;
+    long maxMemorySizeInBytes;
+    String spillableMapBasePath;
+    ExternalSpillableMap.DiskMapType diskMapType;
+    boolean isBitCaskDiskMapCompressionEnabled;
+
+    public Builder<T> withReaderContext(HoodieReaderContext<T> readerContext) {
+      this.readerContext = readerContext;
+      return this;
+    }
+
+    public Builder<T> withHoodieStorage(HoodieStorage storage) {
+      this.storage = storage;
+      return this;
+    }
+
+    public Builder<T> withTablePath(String tablePath) {
+      this.tablePath = tablePath;
+      return this;
+    }
+
+    public Builder<T> withLatestCommitTime(String latestCommitTime) {
+      this.latestCommitTime = latestCommitTime;
+      return this;
+    }
+
+    public Builder<T> withFileSlice(FileSlice fileSlice) {
+      this.fileSlice = fileSlice;
+      return this;
+    }
+
+    public Builder<T> withDataSchema(Schema dataSchema) {
+      this.dataSchema = dataSchema;
+      return this;
+    }
+
+    public Builder<T> withRequestedSchema(Schema requestedSchema) {
+      this.requestedSchema = requestedSchema;
+      return this;
+    }
+
+    public Builder<T> withInternalSchemaOpt(Option<InternalSchema> 
internalSchemaOpt) {
+      this.internalSchemaOpt = internalSchemaOpt;
+      return this;
+    }
+
+    public Builder<T> withMetaClient(HoodieTableMetaClient 
hoodieTableMetaClient) {
+      this.hoodieTableMetaClient = hoodieTableMetaClient;
+      return this;
+    }
+
+    public Builder<T> withTypedProperties(TypedProperties props) {
+      this.props = props;
+      return this;
+    }
+
+    public Builder<T> withTableConfig(HoodieTableConfig tableConfig) {
+      this.tableConfig = tableConfig;
+      return this;
+    }
+
+    public Builder<T> withStart(long start) {
+      this.start = start;
+      return this;
+    }
+
+    public Builder<T> withLength(long length) {
+      this.length = length;
+      return this;
+    }
+
+    public Builder<T> withUseRecordPosition(boolean shouldUseRecordPosition) {
+      this.shouldUseRecordPosition = shouldUseRecordPosition;
+      return this;
+    }
+
+    public Builder<T> withMaxMemorySizeInBytes(long maxMemorySizeInBytes) {
+      this.maxMemorySizeInBytes = maxMemorySizeInBytes;
+      return this;
+    }
+
+    public Builder<T> withSpillableMapBasePath(String spillableMapBasePath) {
+      this.spillableMapBasePath = spillableMapBasePath;
+      return this;
+    }
+
+    public Builder<T> withDiskMapType(ExternalSpillableMap.DiskMapType 
diskMapType) {
+      this.diskMapType = diskMapType;
+      return this;
+    }
+
+    public Builder<T> withBitCaskDiskMapCompressionEnabled(boolean 
isBitCaskDiskMapCompressionEnabled) {
+      this.isBitCaskDiskMapCompressionEnabled = 
isBitCaskDiskMapCompressionEnabled;
+      return this;
+    }
+
+    public HoodieFileGroupReader<T> build() {
+      ValidationUtils.checkArgument(readerContext != null);
+      ValidationUtils.checkArgument(fileSlice != null);
+      ValidationUtils.checkArgument(dataSchema != null);
+      ValidationUtils.checkArgument(requestedSchema != null);
+      if (internalSchemaOpt == null) {

Review Comment:
   other like `shouldUseRecordPosition`, 
`maxMemorySizeInBytes`,`spillableMapBasePath`... may be can give default value



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