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

   
   ### Describe the issue this Pull Request addresses
   
   `InstantFileNameGeneratorV1` and `InstantFileNameGeneratorV2` were 
byte-identical except for five members. The other 33 methods (the 
`StringUtils.join(instantTime, EXTENSION)` one-liners plus `makeDeltaFileName`, 
`getCommitFromCommitFile`, `makeFileNameAsComplete` and 
`makeFileNameAsInflight`) were maintained twice, so any new extension had to be 
added in both places.
   
   ### Summary and Changelog
   
   No user-visible change. Pure code motion inside `hudi-common`.
   
   - Add abstract `BaseInstantFileNameGenerator` in 
`org.apache.hudi.common.table.timeline`, next to the interface, holding the 33 
layout-independent bodies unchanged.
   - `InstantFileNameGeneratorV1` and `InstantFileNameGeneratorV2` now extend 
it and keep only what differs per layout version:
     - `getLayoutVersion`
     - `makeRequestedClusteringFileName` / `makeInflightClusteringFileName` (V1 
aliases the replace-commit names, V2 has dedicated clustering extensions)
     - `getFileName(HoodieInstant)` / `getFileName(String completionTime, 
HoodieInstant)` (V2 emits `requestedTime_completionTime` for completed instants)
   - The `InstantFileNameGenerator` interface is unchanged, 
`DefaultInstantFileNameGenerator` still extends V2, and every caller goes 
through the interface or `TimelineLayout`, so no call site changes.
   
   The five members are left abstract rather than defaulted, so a future layout 
version still has to state them explicitly.
   
   <details>
   <summary>Details</summary>
   
   - A base class was chosen over interface default methods so out-of-repo 
implementers of `InstantFileNameGenerator` are not affected.
   - The only text edit inside a retained body is V1's comment typo `1n 0.x` to 
`In 0.x`.
   - Both concrete classes keep their public no-arg constructors, so the direct 
constructions in `TimelineLayout`, `TimelineArchiverV1`, 
`HoodieMetaserverBasedTimeline` and the Spark tests 
(`TestSparkReaderContextFactory`, `TestHoodieSparkRollback`, 
`TestColumnStatsIndex`) compile as before.
   - Behaviour is pinned by the existing hudi-common timeline tests; no new 
tests, since no generated name changes.
   - Diffstat: 3 files changed, 205 insertions(+), 339 deletions(-)
   
   </details>
   
   ### Impact
   
   None. The generated file names are identical for every action, state and 
layout version.
   
   ### Risk Level
   
   none
   
   ### 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]

Reply via email to