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

   ### Describe the issue this Pull Request addresses
   
   Four standalone tools in hudi-utilities have no test coverage (0% on 
Codecov, master 56eae7b4): `HoodieDropPartitionsTool` (165 lines), 
`HoodieDataTableValidator` (160), `TableSizeStats` (194) and `HoodieTTLJob` 
(47). Part of the effort to bring repository coverage from 79.31% to 80%.
   
   ### Summary and Changelog
   
   Adds one test class per tool. Each writes a tiny three-partition COW table 
through `HoodieSparkClientTestBase`, runs the tool in-process with its `(jsc, 
Config)` constructor, and asserts on the table afterwards (timeline, 
replacecommit metadata, file system view) or, for `TableSizeStats`, on the log 
lines that are its only output.
   
   Also fixes a bug found while writing the tests: 
`HoodieDataTableValidator.Config.equals` cast to 
`HoodieMetadataTableValidator.Config` (copy-paste from the sibling class) and 
threw `ClassCastException` for any two distinct instances. It now casts to its 
own `Config`; the new equals assertion fails without the fix.
   
   Not covered, on purpose: each tool's `main()` (builds its own SparkContext 
and calls `System.exit`) and `HudiHiveSyncJob`, whose test stays `@Disabled` 
pending a metastore in CI.
   
   <details>
   <summary>Tests added (32)</summary>
   
   - `TestHoodieDropPartitionsTool` (8): dry-run leaves the timeline and files 
untouched; delete writes one replacecommit masking exactly the named 
partitions; write properties from `--props` vs `--hoodie-conf`; unsupported 
mode; hive-sync config validation and a failing sync both happening after the 
drop is committed; `Config` equals/hashCode/toString with credential masking.
   - `TestHoodieDataTableValidator` (8): healthy table; dangling base file 
before the active timeline, with and without `--ignore-failed`; extra file for 
a completed commit; continuous mode stopping on the first failure; missing 
props file; `Config` contracts.
   - `TestTableSizeStats` (14): table and partition stats for every partition; 
total-size-only mode; `--start-date`, `--end-date`, `--num-days` filtering 
across all include/exclude arms; base paths from `--props-path`; the five error 
branches (missing base path, unreadable props, partitions without dates, 
inverted interval, negative days, unparseable date).
   - `TestHoodieTTLJob` (2): both constructors; partitions older than 
`hoodie.partition.ttl.days.retain` are replaced, the fresh one survives, 
`hoodie.clean.async` is forced off.
   
   </details>
   
   ### Impact
   
   No user-facing change. `HoodieDataTableValidator.Config.equals` no longer 
throws. Adds about 35 s to the `test-utilities` job.
   
   ### Risk Level
   
   low. The only production change is the one-line cast fix in 
`HoodieDataTableValidator.Config.equals`.
   
   ### 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