rdblue opened a new pull request, #18704:
URL: https://github.com/apache/iceberg/pull/18704

   This adds `merge` to merge set bits from another bitmap into a 
`MutableBitmap`. This will be used when resolving conflicts that affect 
manifest bitmaps.
   
   Tests were written by Claude. Here is its test plan:
   
   Test plan: `MutableBitmap.merge` (23 tests)
   
     "Sparse with dense array" means a 31-position sparse container that has 
already built its dense array. You get one by calling `set` on a position that 
is already set.
   
   Checks in every test
   
   | Check | How |
   |---|---|
   | Cardinality | `cardinality()` equals the size of the union. Together with 
the set-position checks, this means the result is exactly the union. |
   | Descriptors | `descriptorArray()` of the merged bitmap matches the 
expected descriptor for each container. |
   | Sparse positions | Every position in an `int[]` input is set, checked with 
`assertSet(bitmap, containerIndex, positions)` |
   | Dense positions | Every bit set in a dense input's bytes is set, checked 
with `assertSet(bitmap, containerIndex, dense)` |
   
   `Container.merge` cases
   
   Every combination of receiver container type and argument container type is 
covered. Test names leave off the `testMerge` prefix.
   
   | Receiver | Sparse argument | Dense argument | Sparse with dense array 
argument |
   |---|---|---|---|
   | Empty | `IntoEmptyBitmap` | `IntoEmptyBitmap` | 
`SparseWithDenseArrayIntoEmpty` |
   | Sparse | `SparseIntoSparse` | `DenseIntoSparse` | 
`SparseWithDenseArrayIntoSparse` |
   | Sparse with dense array | `SparseIntoSparseWithDenseArray` | 
`DenseIntoSparseWithDenseArray` | 
`SparseWithDenseArrayIntoSparseWithDenseArray` |
   | Dense | `SparseIntoDense` | `DenseIntoDense` | 
`SparseWithDenseArrayIntoDense` |
   
   In addition, test values were chosen for specific purposes:
   
   | Test | Purpose |
   |---|---|
   | `testMergeSparseIntoSparseConvertsToDense` | The union of two sparse 
containers goes past 31 positions, so the result becomes dense |
   | `testMergeSparseIntoSparseWithDenseArray` | The result reaches exactly 32 
positions |
   | `testMergeSparseWithDenseArrayIntoSparse` | The union stays at exactly 31, 
which is the case where merge copies the argument's sparse array |
   | `testMergeSparseWithDenseArrayIntoSparseWithDenseArray` | The receiver has 
0-30 and the argument has 1-31, so the union has 32 positions and the result is 
dense |
   | `testMergeSparseWithDenseArrayIntoDense` | Both sides have a dense array, 
so this takes the OR path. It pins the result whether merge decides the 
argument is dense by its dense array or by its cardinality. |
   
   Container layout cases:
   
   | Test | Case |
   |---|---|
   | `testMergeEmptyContainers` | An empty container on either side, for both 
sparse and dense |
   | `testMergeIntoEmptyBitmap` | The receiver has no containers |
   | `testMergeEmptyBitmap` | The argument has no containers |
   | `testMergeWithMoreContainers` | The argument has more containers than the 
receiver |
   | `testMergeArgumentWithFewerContainers` | The argument has fewer containers 
than the receiver |
   | `testMergeWithEmptyContainerGaps` | Gaps of empty containers on both sides 
|
   | `testMergeIntoOverlayAndBaseContainers` | One receiver container has an 
overlay, another exists only in the base |
   
   Argument type cases:
   
   | Test | Case |
   |---|---|
   | `testMergeBitmapWithBufferOffset` | A `MumblingBitmap` whose buffer has a 
non-zero position |
   | `testMergeMutableWithoutOverlays` | A `Mutable` with no overlays |
   | `testMergeMutableWithOverlays` | A `Mutable` built entirely from `set` 
calls |
   | `testMergeMutableWithMixedOverlays` | A `Mutable` where some containers 
have overlays and others don't |
   
   The shared state test, `testMergeDoesNotShareContainers`, validates that 
state is copied from the merged bitmap and is not shared.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to