JeonDaehong commented on code in PR #18027:
URL: https://github.com/apache/iceberg/pull/18027#discussion_r4037323673
##########
core/src/test/java/org/apache/iceberg/deletes/TestBitmapPositionDeleteIndex.java:
##########
@@ -74,6 +78,116 @@ public void testForEachEmptyIndex() {
assertThat(positions).isEmpty();
}
+ @Test
+ public void testForEachInRange() {
+ PositionDeleteIndex index = indexOf(10L, 11L, 12L, 13L);
+
+ // the beginning is inclusive and the end is exclusive
+ assertThat(collect(index, 11L, 13L)).containsExactly(11L, 12L);
+ assertThat(collect(index, 11L, 12L)).containsExactly(11L);
+
+ // a range that ends where the deletes start
+ assertThat(collect(index, 0L, 10L)).isEmpty();
+
+ // a range that starts after the deletes end
+ assertThat(collect(index, 14L, 24L)).isEmpty();
+ }
+
+ @Test
+ public void testForEachInRangeAscendingOrder() {
+ PositionDeleteIndex index = indexOf(9L, 3L, 7L, 1L, 5L);
+ assertThat(collect(index, 0L, 20L)).containsExactly(1L, 3L, 5L, 7L, 9L);
+ }
+
+ @Test
+ public void testForEachInRangeEmptyRange() {
+ PositionDeleteIndex index = indexOf(0L, 1L, 2L);
+ assertThat(collect(index, 0L, 0L)).isEmpty();
Review Comment:
Added `testForEachInRangeInvalidRange`. The range is validated in three
separate places -- the default method, `BitmapPositionDeleteIndex` (via
`RoaringPositionBitmap`) and `EmptyPositionDeleteIndex` -- so the test covers
all three. I verified it by disabling each precondition in turn and confirming
the test fails for each.
--
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]