cshuo opened a new pull request, #19050:
URL: https://github.com/apache/hudi/pull/19050

   ### Describe the issue this Pull Request addresses
   
   `FlinkRowDataReaderContext#getFileRecordIterator` previously branched on the 
underlying file format inline: it special-cased Lance files (instantiating 
`HoodieRowDataLanceReader`, validating schema-evolution constraints, and 
building the iterator) and then fell through to a separate Parquet path 
(`HoodieRowDataParquetReader`). This duplicated reader-acquisition logic, and 
made the method harder to extend as new formats are added.
   
   This PR introduces a common `HoodieRowDataFileReader` abstraction so the 
reader context can acquire a reader and obtain an iterator through a single, 
format-agnostic entry point, pushing per-format behavior down into the concrete 
readers.
   
   ### Summary and Changelog
   
   - Added a new `HoodieRowDataFileReader` interface (extends 
`HoodieFileReader<RowData>`) exposing a uniform `getRowDataIterator(dataSchema, 
requiredSchema, internalSchemaManager, predicates)` entry point.
   - Refactored `FlinkRowDataReaderContext#getFileRecordIterator` to drop the 
Lance/Parquet branching: it now selects `HoodieFileFormat.LANCE` vs 
`HoodieFileFormat.PARQUET` (non-Lance, including log files, read via the 
parquet reader), acquires a single `HoodieRowDataFileReader`, and delegates 
iterator creation, with unified error handling and reader close on failure.
   
   ### Impact
   - **Functional impact**: No intended behavior change. Lance files still 
enforce the no-schema-evolution validation, and non-Lance/log files continue to 
be read by the parquet reader; only the dispatch path is restructured.
   - **Maintainability**: Removes duplicated reader-acquisition and 
error-handling logic in `FlinkRowDataReaderContext`; format-specific concerns 
now live inside each reader.
   - **Extensibility**: New RowData file formats can be supported by 
implementing `HoodieRowDataFileReader` without further branching in the reader 
context.
   
   ### Risk Level
   
   Low. 
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] 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]

Reply via email to