Skip to content

fix: Fix flaky test TestProtoConversionUtil#allFieldsSet_wellKnownTyp…#18352

Merged
danny0405 merged 1 commit intoapache:masterfrom
cshuo:fix_flaky_proto_test
Mar 21, 2026
Merged

fix: Fix flaky test TestProtoConversionUtil#allFieldsSet_wellKnownTyp…#18352
danny0405 merged 1 commit intoapache:masterfrom
cshuo:fix_flaky_proto_test

Conversation

@cshuo
Copy link
Collaborator

@cshuo cshuo commented Mar 19, 2026

…esAndTimestampsAsRecords

Describe the issue this Pull Request addresses

TestProtoConversionUtil#allFieldsSet_wellKnownTypesAndTimestampsAsRecords can fail nondeterministically due to random unsigned test data generation.

A concrete failure example:

  • Expected record had "primitive_unsigned_int": 3514477690
  • Actual record had "primitive_unsigned_int": -780489606

These two values represent the same 32-bit pattern, but one is interpreted as unsigned (3514477690) and the other as signed (-780489606). Because the test compares full records, this mismatch causes assertion failure.

Root cause in test input generation: primitiveUnsignedInt was generated via RANDOM.nextInt() (can be negative).

Summary and Changelog

Updated unsigned random data generation in TestProtoConversionUtil:

  • primitiveUnsignedInt
    • from: RANDOM.nextInt()
    • to: Math.abs(RANDOM.nextInt())

Impact

Improved determinism and reduced flaky failures.

Risk Level

low.

Documentation Update

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@cshuo cshuo force-pushed the fix_flaky_proto_test branch from 9506802 to 6b1eef9 Compare March 19, 2026 14:30
@github-actions github-actions bot added the size:XS PR with lines of changes in <= 10 label Mar 19, 2026
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.42%. Comparing base (19c4cc9) to head (6b1eef9).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18352      +/-   ##
============================================
+ Coverage     66.10%   68.42%   +2.32%     
- Complexity    22301    27402    +5101     
============================================
  Files          1988     2423     +435     
  Lines        110007   132458   +22451     
  Branches      13867    15974    +2107     
============================================
+ Hits          72716    90632   +17916     
- Misses        31104    34778    +3674     
- Partials       6187     7048     +861     
Flag Coverage Δ
common-and-other-modules 44.34% <ø> (?)
hadoop-mr-java-client 45.16% <ø> (-0.01%) ⬇️
spark-client-hadoop-common 48.31% <ø> (ø)
spark-java-tests 48.82% <ø> (ø)
spark-scala-tests 45.00% <ø> (-0.01%) ⬇️
utilities 38.61% <ø> (+<0.01%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cshuo cshuo requested a review from danny0405 March 20, 2026 02:53
@hudi-bot
Copy link
Collaborator

CI report:

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

@danny0405 danny0405 merged commit 3aef2ca into apache:master Mar 21, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS PR with lines of changes in <= 10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants