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

   ### Describe the issue this Pull Request addresses
   
   Closes #19880.
   metadata stats printed a header followed by (empty) for a table with the 
metadata table enabled. MetadataCommand.stats() constructed 
HoodieMetadataConfig with enable(true) and no metrics configuration, so 
HoodieBackedTableMetadata.stats() returned an empty map and the CLI rendered no 
stats rows.
   
   ### Summary and Changelog
   
   - Calculate metadata stats when requested without requiring a metrics 
reporter.
   
   - Preserve the existing public HoodieMetadataMetrics.getStats(...) instance 
method and use a package-private static method for the calculation.
   
   - Update the existing CLI functional test to require a positive 
partitionCount.
   
   The existing TestMetadataCommand.testMetadataStatsAndFileListing functional 
test creates a table with metadata enabled, connects to it, and executes 
metadata stats.
   
   Before the fix, the CLI output contained:
   
   ```
   ╔══════════╤════════════╗
   ║ stat key │ stat value ║
   ╠══════════╧════════════╣
   ║ (empty)               ║
   ╚═══════════════════════╝
   ```
   
   The updated assertion failed against the original code. After the fix, the 
output included:
   
   ```
   ╟───────────────────────────────────────────┼────────────╢
   ║ partitionCount                            │ 2          ║
   ╟───────────────────────────────────────────┼────────────╢
   ```
   
   It also included file size statistics. Values may vary between test runs.
   
   ### Impact
   
   Restores the expected output of the existing metadata stats CLI command. No 
configuration or storage format changes. The existing public getStats(...) 
method remains available.
   
   ### Risk Level
   
   Low. Calling stats() now calculates file and partition statistics even when 
metrics reporting is disabled, so the command may do more work on large tables. 
This happens only when stats are requested. The existing public getStats(...) 
method is preserved, and the focused functional test passes.
   
   ### 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