wombatu-kun commented on code in PR #18375:
URL: https://github.com/apache/hudi/pull/18375#discussion_r3035481798
##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieFileWriterFactory.java:
##########
@@ -49,7 +49,13 @@ public static <T, I, K, O> HoodieFileWriter getFileWriter(
String instantTime, StoragePath path, HoodieStorage storage,
HoodieConfig config, HoodieSchema schema,
TaskContextSupplier taskContextSupplier, HoodieRecordType recordType)
throws IOException {
final String extension = FSUtils.getFileExtension(path.getName());
- HoodieFileWriterFactory factory =
HoodieIOFactory.getIOFactory(storage).getWriterFactory(recordType);
+ HoodieRecordType fixedType;
+ try {
+ fixedType =
HoodieFileFormat.fromFileExtension(extension).requiresSparkRecordType() ?
HoodieRecordType.SPARK : recordType;
Review Comment:
Good point. Added `HoodieFileFormat.fromFileExtensionOrNull()` and
refactored the caller. No more exception-based control flow.
--
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]