Skip to content

test(spark): extend Spark 4 variant shredding coverage - #19403

Open
yihua wants to merge 1 commit into
apache:masterfrom
yihua:test-spark4-variant-shredding-coverage
Open

test(spark): extend Spark 4 variant shredding coverage#19403
yihua wants to merge 1 commit into
apache:masterfrom
yihua:test-spark4-variant-shredding-coverage

Conversation

@yihua

@yihua yihua commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.48%. Comparing base (8e18999) to head (af84338).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19403      +/-   ##
============================================
+ Coverage     72.49%   74.48%   +1.98%     
+ Complexity    32888    32194     -694     
============================================
  Files          2574     2574              
  Lines        149010   142978    -6032     
  Branches      18749    17584    -1165     
============================================
- Hits         108032   106498    -1534     
+ Misses        32513    28462    -4051     
+ Partials       8465     8018     -447     
Components Coverage Δ
hudi-common 82.24% <ø> (+<0.01%) ⬆️
hudi-client 81.76% <ø> (-0.03%) ⬇️
hudi-flink 78.63% <ø> (+<0.01%) ⬆️
hudi-spark-datasource 66.50% <ø> (+7.82%) ⬆️
hudi-utilities 71.20% <ø> (-0.02%) ⬇️
hudi-cli 15.32% <ø> (ø)
hudi-hadoop 63.49% <ø> (ø)
hudi-sync 70.67% <ø> (+0.05%) ⬆️
hudi-io 79.57% <ø> (ø)
hudi-timeline-service 83.44% <ø> (ø)
hudi-cloud 64.00% <ø> (ø)
hudi-kafka-connect 53.20% <ø> (-0.77%) ⬇️
Flag Coverage Δ
common-and-other-modules 47.77% <ø> (+0.34%) ⬆️
flink-integration-tests 47.62% <ø> (-0.01%) ⬇️
hadoop-mr-java-client 43.39% <ø> (+0.01%) ⬆️
integration-tests 13.63% <ø> (+0.10%) ⬆️
spark-client-hadoop-common 48.71% <ø> (+<0.01%) ⬆️
spark-java-tests 50.74% <ø> (+1.35%) ⬆️
spark-scala-tests 45.76% <ø> (+1.11%) ⬆️
utilities 36.65% <ø> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 42 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the size:M PR with lines of changes in (100, 300] label Jul 29, 2026
@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@yihua
yihua marked this pull request as ready for review July 30, 2026 19:29

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

No reviewable code files in this PR.

cc @yihua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M PR with lines of changes in (100, 300]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants