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

   ### Describe the issue this Pull Request addresses
   
   Second round of hudi-cli coverage after #18816 wired the module into CI. On 
Codecov (master 56eae7b4) `TimelineCommand` sits at 3%, `ExportCommand` at 2%, 
`MetadataCommand` at 19% and `SparkMain` at 23%, because the shell commands 
reach `SparkMain` only through a `spark-submit` child process that JaCoCo never 
sees. Part of the effort to bring repository coverage from 79.31% to 80%.
   
   ### Summary and Changelog
   
   30 new test executions across eight `@Tag("functional")` classes, all built 
on the existing `CLIFunctionalTestHarness`. The rendered tables are checked 
cell by cell through a new `renderedRows` helper on the harness rather than by 
substring.
   
   The one production change is visibility: ten `SparkMain` helpers 
(`doCompactValidate`, `doCompactRepair`, `doCompactUnschedule`, 
`doCompactUnscheduleFile`, `compact`, `cluster`, `rollback`, `createSavepoint`, 
`rollbackToSavepoint`, `deleteSavepoint`) go from `private static` to 
package-private `@VisibleForTesting static`, matching the existing `archive` 
helper. `SparkMain.main` ends in `jsc.stop()` plus `System.exit`, so this is 
the only way to reach them in-process. No body or behaviour change.
   
   <details>
   <summary>Tests added, by class</summary>
   
   - `TestTimelineCommand` (new, 8): `timeline show active` / `incomplete` and 
`metadata timeline show active` / `incomplete`, with `--limit`, `--sortBy`, 
`--desc`, `--headeronly`, `--with-metadata-table`, `--show-rollback-info`, 
`--show-time-seconds`; the fixture has completed, rolled-back and requested 
commits so every rendering branch runs.
   - `TestExportCommand` (new, 2): `export instants` file names and content, 
and the invalid-folder guard.
   - `TestMetadataCommand` (+4): `stats`, `list-partitions`, `list-files` with 
and without a partition, `validate-files` in both verbose arms with a planted 
stray base file, `create` / `init` on a table without a metadata table, `set`.
   - `TestCompactionCommand` (+6 methods, 11 executions): compaction validate 
on a healthy plan and on one with a deleted log file, repair, unschedule plan 
and unschedule file across the `skipValidation` / `dryRun` combinations, and 
schedule-and-execute compaction on a MOR table with log files.
   - `TestClusteringCommand` (new, 1): schedule-and-execute clustering leaves 
one replace commit and nothing pending.
   - `TestRollbacksCommand` (+1) and `TestSavepointsCommand` (+1): the rollback 
and savepoint entry points, including the failure return codes.
   
   </details>
   
   <details>
   <summary>Bugs found while writing these, deliberately not pinned</summary>
   
   - `metadata delete-record-index` throws NPE when run before any other 
metadata command (it never calls `initJavaSparkContext`).
   - `export instants` fails on tables of version 8 and above unless `--desc` 
is set with a limit (the archived-timeline glob returns the LSM history 
directory and opens it as a log file) and ignores `--limit` for active instants.
   - `metadata stats` can never print rows because metrics are hardcoded off.
   - `CompactionAdminClient.unscheduleCompactionFileId` filters with `!fileId 
&& !partition`, so it also drops every other pending operation in the same 
partition.
   
   </details>
   
   ### Impact
   
   No user-facing change. About 2.5 minutes more in the `FT - hudi-cli` step of 
the spark-client job.
   
   ### Risk Level
   
   low. The only production change is method visibility in `SparkMain`.
   
   ### 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