Add non-partitioned table tests for RewriteFiles and OverwriteFiles#4137
Open
Takch02 wants to merge 5 commits intoapache:masterfrom
Open
Add non-partitioned table tests for RewriteFiles and OverwriteFiles#4137Takch02 wants to merge 5 commits intoapache:masterfrom
Takch02 wants to merge 5 commits intoapache:masterfrom
Conversation
Test : Add NonPartition Test case of RewriteFile
Author
|
I re-uploaded it after checking the CI and adhering to code conventions. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4137 +/- ##
=========================================
Coverage 29.90% 29.90%
Complexity 4160 4160
=========================================
Files 670 670
Lines 53533 53533
Branches 6797 6797
=========================================
+ Hits 16008 16010 +2
+ Misses 36343 36341 -2
Partials 1182 1182
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 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.
Motivation
Currently, TestRewriteFiles and TestOverwriteFiles only verify the behavior of partitioned tables, expecting a CannotAlterHiveLocationException when partial rewrites or overwrites attempt to reference multiple directories. Non-partitioned tables, however, are not bound by Hive's strict 1-partition-1-folder constraint and should successfully commit these operations. This PR adds the missing coverage for non-partitioned tables.
Key Changes
Added NonPartitioned methods in TestRewriteFiles and TestOverwriteFiles using Assume.assumeFalse(isPartitionedTable()).
Verified successful commits instead of expecting exceptions, as non-partitioned tables gracefully handle files across multiple directories.
Introduced Dynamic Assertions: Replaced hardcoded integer values with dynamic size assertions to prevent fragile tests. This ensures the tests remain robust regardless of table properties (e.g., Primary Key bucketing or target file size limits).
Comprehensive State Verification: Implemented a two-step verification process for each test:
Action Verification: Checked the exact number of files added in the latest transaction using lastedAddedFiles().
State Verification: Checked the total number of live files in the current snapshot using baseStore.newScan().planFiles().
Example of Verification Logic:
Rewrite: Verified afterFiles.size() and totalLiveFiles against addFiles.size().
Overwrite: Verified afterFiles.size() against secondDataFiles.size(), and totalLiveFiles against firstDataFiles.size() + secondDataFiles.size().