yihua opened a new pull request, #19221: URL: https://github.com/apache/hudi/pull/19221
### Describe the issue this Pull Request addresses Several `hudi-common` metrics and schema utility classes carry conversion, promotion, and reporter-mapping logic that was thinly covered by unit tests. This PR raises unit-test coverage for those classes without touching production code and without any Spark or network dependencies. ### Summary and Changelog Adds JUnit 5 unit tests (no Spark, no real network I/O) for three low-covered `hudi-common` areas: - `ValueType` (`org.apache.hudi.metadata.stats`): extends the existing `TestValueType` suite with per-type conversion coverage. Exercises the numeric cast branches (int/long/float/double, including boolean and string best-effort paths) through the enum's standardize entry point, the string/bytes/fixed cast branches (including the fixed-rejects-string difference), decimal/UUID/date/time/timestamp/local-timestamp round trips through the `castTo*`/`to*`/`from*` helpers, `fromParquetPrimitiveType`, `fromSchema` (primitives plus union unwrapping), and `fromOrdinal` round-trip. - `HoodieSchemaTypePromotion` (`org.apache.hudi.common.schema`): new same-package suite covering the promotion matrix (int/long/float widening, string<->bytes bidirectional, string-reads-numeric, narrowing rejected, unrelated types rejected) and decimal widening rules (same-size precision widening, identical, decreased precision rejected, increased scale without integer-digit room rejected, differing fixed size rejected, non-decimal rejected). - `M3ScopeReporterAdaptor` (`org.apache.hudi.metrics.m3`): new suite feeding a real codahale `MetricRegistry` and asserting the exact counters/gauges that reach a mocked `com.uber.m3.tally.Scope` (counter forwarding, gauge value forwarding, histogram count plus the ten snapshot gauges, meter count-counter plus four rate gauges, timer metered-plus-snapshot, empty-registry no-op, multiple gauges). The scope is mocked so assertions verify the registry-to-scope mapping rather than any emission side effect. No production code changed. Reporter-adjacent tests hold no ports, threads, or static state. ### Impact None. Test-only change; no public API, behavior, or performance impact. ### Risk Level low Test-only addition against existing behavior; no production code paths modified. ### 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]
