yihua opened a new pull request, #19255: URL: https://github.com/apache/hudi/pull/19255
### Describe the issue this Pull Request addresses `HoodieFileReaderFactory` and `HoodieFileWriterFactory` each contain multiple independent per-format dispatch sites (extension if-chains plus one switch per overload). Adding a format means editing several switches, and missing one ships a latent bug: that happened twice with VORTEX (the `StoragePathInfo` reader overload and the log-block-type selection, see #19252). This PR makes that bug class structurally impossible inside the two factories. ### Summary and Changelog - `HoodieFileReaderFactory`: a single private `newReaderByFormat` switch now backs every entry point. The extension entry maps the extension to a `HoodieFileFormat` via a format-agnostic helper (loops the enum, so new formats need zero edits there) and delegates. The `StoragePathInfo` overload dispatches HFILE to its `StoragePathInfo`-specific hook (overridden by engine factories to exploit the known file size) and normalizes every other format through the shared switch. - `HoodieFileWriterFactory`: same treatment; the `OutputStream`-based parquet-only entry is preserved verbatim. - All public and protected signatures unchanged; engine factories (Avro, Spark, Flink, Trino plugin) override only the per-format hooks, which are untouched. - New `TestHoodieFileReaderFactory` and `TestHoodieFileWriterFactory` assert, for every `HoodieFileFormat` value, that all entry points dispatch to the same hook, plus exact error messages for unknown extensions and unsupported formats. ### Impact One switch to edit per factory when adding a format. Single behavioral delta: `getFileReader(config, StoragePathInfo, VORTEX, schema)` now dispatches to the Vortex reader instead of throwing; this overlaps the same fix in #19252, and whichever lands second rebases trivially. ### Risk Level low: behavior verified equivalent by exhaustive entry-point-by-format comparison and the new tests; the Vortex round-trip (Spark engine factory + reflection path) and existing factory tests pass, and the Java 11 Spark chain compiles. ### Documentation Update none ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable -- 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]
