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

   ### Describe the issue this Pull Request addresses
   
   `Spark4VariantShreddingProvider` (the AVRO read-path bridge to Spark 4's 
variant shredding writer) was only lightly covered (~32%). Most scalar leaf 
types, the residual/partial-shredding paths, the decimal on-disk decodings, and 
the null/error guards had no test exercising them.
   
   ### Summary and Changelog
   
   Extends the existing `TestSpark4VariantShreddingProvider` (no new test 
class) with cases that pin behavior, not just non-null, on the previously 
uncovered shapes:
   
   - Every scalar leaf type through `avroTypeToScalarType` / 
`convertScalarToAvro`: int, long, float, double, string, boolean, binary (bytes 
and FIXED), UUID, date, timestamp-micros, local-timestamp-micros, decimal. Each 
asserts the exact `typed_value` produced, that there is no residual `value`, 
and that the variant round-trips.
   - Decline-to-shred fallbacks that keep the value in the residual binary: 
millis-precision timestamp / local-timestamp leaves (which 
`avroTypeToScalarType` returns null for), asserting `typed_value` stays null 
and `value` is populated.
   - Partial object shredding: a declared field absent from the variant (null 
`value` + null `typed_value`) and an extra variant field captured in the 
top-level residual `value`.
   - Decimal reconstruction from the encodings a Parquet reader actually feeds 
`rebuild` (a `ByteBuffer` for bytes-backed and a `GenericFixed` for 
fixed-backed decimals), plus the `IllegalStateException` on an unexpected 
decimal representation.
   - Null/error guards: `shredVariantRecord` returning null when 
`value`/`metadata` is missing, `rebuildVariantRecord` returning null for a null 
record, and the `HoodieException` thrown when the required `metadata` is 
missing.
   
   ### Impact
   
   None. Test-only change.
   
   ### Risk Level
   
   none
   
   ### 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]

Reply via email to