test(spark): Simplify I/O-count tests for read_blob batching#18740
Closed
yihua wants to merge 3 commits into
Closed
test(spark): Simplify I/O-count tests for read_blob batching#18740yihua wants to merge 3 commits into
yihua wants to merge 3 commits into
Conversation
…tching Existing tests for the BatchedBlobReader (PR apache#18098) only assert byte correctness of the data returned, so they cannot detect a regression that causes the batching optimization to stop reducing I/O. Add two test classes that close that gap: - TestBatchedBlobReaderMerge: direct unit tests on mergeRanges and identifyConsecutiveRanges (newly package-private), asserting merged range counts, gap-threshold boundaries, multi-file grouping, sort, index preservation, and overlap rejection. No Spark, no I/O. - TestBatchedBlobReaderIO: integration tests that drive processPartition with a CountingHoodieStorage wrapper around a real storage, asserting openSeekable/seek counts across four scenarios — many blobs in one file, contiguous zero-gap blobs, threshold-controlled small/large gaps including the inclusive boundary, and multi-file queries (per-file batching, mixed gap patterns, interleaved input order).
TestSparkSqlHudiPackageStructure rejects Scala test classes under org.apache.spark.sql.hudi.* that are not in the curated allow-list, which is mirrored in two CI configs that drive the wildcard suite filter. The new BatchedBlobReader merge/IO tests live in the .blob package so they can reach private[blob] helpers (mergeRanges, identifyConsecutiveRanges, RowAccessor) without widening internal visibility - matching the same-package pattern already used for the .analysis, .catalog, and .command production sub-packages. Add 'org.apache.spark.sql.hudi.blob' to all three places: - ALLOWED_PACKAGES in TestSparkSqlHudiPackageStructure - job6HudiSparkDdlOthersWildcardSuites in azure-pipelines-20230430.yml - SCALA_TEST_OTHERS_FILTER in .github/workflows/bot.yml
Drop tests that re-verify the merge algorithm at the I/O layer when TestBatchedBlobReaderMerge already covers it. Keep only the cases that prove the merge result maps 1:1 to physical I/O ops: - batching reduces I/O end-to-end (single-file, batched vs baseline) - mixed gaps in one file produce one I/O per merged group - multi-file routing with interleaved input and mixed gap patterns Reduces TestBatchedBlobReaderIO from 9 to 3 tests (~67% fewer Spark DataFrame builds and real file reads, the dominant runtime cost).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18740 +/- ##
============================================
- Coverage 68.14% 68.14% -0.01%
- Complexity 29051 29099 +48
============================================
Files 2516 2517 +1
Lines 140935 141113 +178
Branches 17472 17508 +36
============================================
+ Hits 96047 96155 +108
- Misses 36993 37054 +61
- Partials 7895 7904 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the issue this Pull Request addresses
Follow-up to #18736. The newly added
TestBatchedBlobReaderIOhad several scenarios that re-verified the merge algorithm at the I/O layer whenTestBatchedBlobReaderMergealready covers them as cheap unit tests. Each removed I/O test built a Spark DataFrame and read a real file, so the duplication was the dominant runtime cost of the new suite.Summary and Changelog
maxGapvalues).TestBatchedBlobReaderIOgoes from 9 → 3 tests, retaining the three distinct integration claims: I/O reduction end-to-end, one I/O per merged group, and per-file routing across multiple files.Impact
Tests only. No production code changes. Merge-algorithm coverage is unchanged — every removed I/O scenario has a corresponding test in
TestBatchedBlobReaderMerge.This is stacked on #18736; the diff includes that PR's commits until it lands.
Risk Level
none
Documentation Update
none
Contributor's checklist