yihua opened a new pull request, #11304: URL: https://github.com/apache/hudi/pull/11304
### Change Logs PR targeting master: https://github.com/apache/hudi/pull/11301 This PR targets `branch-0.x` with the same changes. When running tests in Trino with Hudi metadata table (MDT) enabled, the `HoodieAvroHFileWriter` throws class cast exception, since Trino uses dependency injection to provide the Hadoop file system instance, which may skip the Hudi wrapper file system logic. This PR adds new logic to gracefully cast file system instance in Avro writers to handle such cases. ``` Caused by: java.lang.ClassCastException: class io.trino.hdfs.TrinoFileSystemCache$FileSystemWrapper cannot be cast to class org.apache.hudi.hadoop.fs.HoodieWrapperFileSystem (io.trino.hdfs.TrinoFileSystemCache$FileSystemWrapper and org.apache.hudi.hadoop.fs.HoodieWrapperFileSystem are in unnamed module of loader 'app') at org.apache.hudi.io.hadoop.HoodieAvroHFileWriter.<init>(HoodieAvroHFileWriter.java:91) at org.apache.hudi.io.hadoop.HoodieAvroFileWriterFactory.newHFileFileWriter(HoodieAvroFileWriterFactory.java:108) at org.apache.hudi.io.storage.HoodieFileWriterFactory.getFileWriterByFormat(HoodieFileWriterFactory.java:70) at org.apache.hudi.io.storage.HoodieFileWriterFactory.getFileWriter(HoodieFileWriterFactory.java:53) at org.apache.hudi.io.HoodieCreateHandle.<init>(HoodieCreateHandle.java:108) at org.apache.hudi.io.HoodieCreateHandle.<init>(HoodieCreateHandle.java:77) at org.apache.hudi.io.CreateHandleFactory.create(CreateHandleFactory.java:45) at org.apache.hudi.execution.CopyOnWriteInsertHandler.consume(CopyOnWriteInsertHandler.java:101) at org.apache.hudi.execution.CopyOnWriteInsertHandler.consume(CopyOnWriteInsertHandler.java:44) ``` ### Impact Makes Hudi MDT writing in Trino tests work. No impact on production logic in Hadoop-based implementation on Spark. ### Risk level none ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Change Logs and Impact were stated clearly - [ ] Adequate tests were added if applicable - [ ] CI passed -- 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]
