yihua commented on code in PR #10330:
URL: https://github.com/apache/hudi/pull/10330#discussion_r1469127165
##########
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:
I choose not to do it in this PR to avoid large scope of changes. For now
since there's no need I set it aside. I've created a JIRA to track this:
[HUDI-7356](https://issues.apache.org/jira/browse/HUDI-7356).
--
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]