yihua commented on code in PR #11827:
URL: https://github.com/apache/hudi/pull/11827#discussion_r1749508430


##########
hudi-common/src/main/java/org/apache/hudi/common/engine/FileGroupReaderState.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.common.engine;
+
+import org.apache.hudi.common.config.HoodieCommonConfig;
+import org.apache.hudi.common.config.HoodieMemoryConfig;
+import org.apache.hudi.common.config.RecordMergeMode;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.model.HoodieRecordMerger;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.table.read.HoodieFileGroupReaderSchemaHandler;
+import org.apache.hudi.common.util.ConfigUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.internal.schema.InternalSchema;
+
+import org.apache.avro.Schema;
+
+import static org.apache.hudi.common.util.ConfigUtils.getStringWithAltKeys;
+
+public class FileGroupReaderState {
+  private HoodieFileGroupReaderSchemaHandler schemaHandler = null;
+  private String latestCommitTime = null;
+  private HoodieRecordMerger recordMerger = null;
+  private RecordMergeMode recordMergeMode = null;
+  private Boolean hasLogFiles = null;
+  private Boolean hasBootstrapBaseFile = null;
+  private Boolean needsBootstrapMerge = null;
+  private Boolean shouldMergeUseRecordPosition = null;
+  private Boolean supportsParquetRowIndex = null;
+  private HoodieTableMetaClient metaClient = null;
+  private Option<String> partitionNameOverrideOpt = null;
+  private Option<String[]> partitionPathFieldOpt = null;
+  private TypedProperties props = null;
+  private Integer bufferSize = null;

Review Comment:
   Make some of these final if they can be set when constructing the instance.  
Also ad a Builder class.  Only allow setters that has to be set latter.



##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieFileGroupReaderSchemaHandler.java:
##########
@@ -72,22 +71,21 @@ public class HoodieFileGroupReaderSchemaHandler<T> {
 
   protected final boolean needsMORMerge;
 
-  public HoodieFileGroupReaderSchemaHandler(HoodieReaderContext<T> 
readerContext,
+  public HoodieFileGroupReaderSchemaHandler(FileGroupReaderState readerState,
                                             Schema dataSchema,
                                             Schema requestedSchema,
-                                            Option<InternalSchema> 
internalSchemaOpt,
-                                            HoodieTableConfig 
hoodieTableConfig) {
-    this.readerContext = readerContext;
-    this.hasBootstrapBaseFile = readerContext.getHasBootstrapBaseFile();
-    this.needsMORMerge = readerContext.getHasLogFiles();
-    this.recordMerger = readerContext.getRecordMerger();
+                                            Option<InternalSchema> 
internalSchemaOpt) {
+    this.readerState = readerState;
+    this.hasBootstrapBaseFile = readerState.getHasBootstrapBaseFile();
+    this.needsMORMerge = readerState.getHasLogFiles();
+    this.recordMerger = readerState.getRecordMerger();

Review Comment:
   Similar here.  Remove all variables that can be replaced by `readerState` 
calls.



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