Copilot commented on code in PR #2678:
URL: https://github.com/apache/uniffle/pull/2678#discussion_r2612681141
##########
common/src/main/java/org/apache/uniffle/common/util/RssUtils.java:
##########
@@ -407,44 +407,25 @@ public static void checkProcessedBlockIds(
Roaring64NavigableMap exceptedBlockIds, Set<Long> processedBlockIds) {
Iterator<Long> it = exceptedBlockIds.iterator();
int expectedCount = 0;
- int actualCount = 0;
+ int matchedCount = 0;
while (it.hasNext()) {
expectedCount++;
- if (processedBlockIds.contains(it.next())) {
- actualCount++;
+ if (processedBlockIds.remove(it.next())) {
Review Comment:
The method now mutates the input parameter `processedBlockIds` by calling
`remove()`. This is a breaking behavioral change that could affect callers who
reuse this Set. Consider either documenting this side effect clearly, cloning
the Set before modification, or renaming the parameter to indicate it will be
modified (e.g., `mutableProcessedBlockIds`).
##########
common/src/test/java/org/apache/uniffle/common/util/RssUtilsTest.java:
##########
@@ -59,6 +60,32 @@
public class RssUtilsTest {
+ @Test
+ public void testCheckProcessedBlockIds() throws Exception {
+ Roaring64NavigableMap exceptedBlockIds = new Roaring64NavigableMap();
+ exceptedBlockIds.add(1);
+ exceptedBlockIds.add(2);
+
+ // case1: illegal should throw exception
+ Set<Long> processedBlockIds = new HashSet<>();
+ processedBlockIds.add(1L);
+ processedBlockIds.add(2L);
+ processedBlockIds.add(3L);
+
+ try {
+ RssUtils.checkProcessedBlockIds(exceptedBlockIds, processedBlockIds);
+ fail();
Review Comment:
The test should verify the exception message or type, not just that any
exception is thrown. Consider using assertThrows with a specific exception type
check and optionally validating the error message contains expected text like
'illegal' and '1 blocks'.
##########
common/src/test/java/org/apache/uniffle/common/util/RssUtilsTest.java:
##########
@@ -59,6 +60,32 @@
public class RssUtilsTest {
+ @Test
+ public void testCheckProcessedBlockIds() throws Exception {
+ Roaring64NavigableMap exceptedBlockIds = new Roaring64NavigableMap();
Review Comment:
Corrected spelling of 'excepted' to 'expected'.
--
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]