CTTY commented on code in PR #10330:
URL: https://github.com/apache/hudi/pull/10330#discussion_r1467140581


##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieFileReaderFactory.java:
##########
@@ -55,37 +60,82 @@ public static HoodieFileReaderFactory 
getReaderFactory(HoodieRecord.HoodieRecord
     }
   }
 
-  public HoodieFileReader getFileReader(Configuration conf, Path path) throws 
IOException {
+  public HoodieFileReader getFileReader(HoodieConfig hoodieConfig, 
Configuration conf, Path path) throws IOException {
     final String extension = FSUtils.getFileExtension(path.toString());
     if (PARQUET.getFileExtension().equals(extension)) {
-      return newParquetFileReader(conf, path);
+      return getFileReader(hoodieConfig, conf, path, PARQUET, Option.empty());
     }
     if (HFILE.getFileExtension().equals(extension)) {
-      return newHFileFileReader(conf, path);
+      return getFileReader(hoodieConfig, conf, path, HFILE, Option.empty());
     }
     if (ORC.getFileExtension().equals(extension)) {
-      return newOrcFileReader(conf, path);
+      return getFileReader(hoodieConfig, conf, path, ORC, Option.empty());
     }
     throw new UnsupportedOperationException(extension + " format not supported 
yet.");
   }
 
-  public HoodieFileReader getFileReader(Configuration conf, Path path, 
HoodieFileFormat format) throws IOException {
-    return this.newParquetFileReader(conf, path);
+  public HoodieFileReader getFileReader(HoodieConfig hoodieConfig, 
Configuration conf, Path path, HoodieFileFormat format)
+      throws IOException {
+    return getFileReader(hoodieConfig, conf, path, format, Option.empty());
+  }
+
+  public HoodieFileReader getFileReader(HoodieConfig hoodieConfig,
+                                        Configuration conf, Path path, 
HoodieFileFormat format,
+                                        Option<Schema> schemaOption) throws 
IOException {
+    switch (format) {
+      case PARQUET:
+        return this.newParquetFileReader(conf, path);
+      case HFILE:
+        boolean useBuiltInHFileReader =
+            
hoodieConfig.getBooleanOrDefault(HoodieReaderConfig.USE_BUILT_IN_HFILE_READER);
+        return newHFileFileReader(useBuiltInHFileReader, conf, path, 
schemaOption);

Review Comment:
   Can we pass `HoodieConfig` down to `newHFileReader`  instead of passing 
`useBuiltInHFileReader` only. So it'd be easier to add more customization 
directly to file reader level in the future without having to change 
`newHFileFileReader` method. 
   An alternative is we put `HoodieConfig` into `conf`



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