Copilot commented on code in PR #3754:
URL: https://github.com/apache/celeborn/pull/3754#discussion_r3541395403


##########
common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala:
##########
@@ -269,10 +269,12 @@ class WorkerInfo(
     val userResourceConsumptionString =
       if (userResourceConsumption == null || userResourceConsumption.isEmpty) {
         "empty"
-      } else if (userResourceConsumption != null) {
-        userResourceConsumption.asScala.map { case (userIdentifier, 
resourceConsumption) =>
-          s"\n  UserIdentifier: ${userIdentifier}, ResourceConsumption: 
${resourceConsumption}"
+      } else {
+        val rendered = userResourceConsumption.asScala.iterator.collect {
+          case (userIdentifier, resourceConsumption) if 
!resourceConsumption.isEmpty =>
+            s"\n  UserIdentifier: ${userIdentifier}, ResourceConsumption: 
${resourceConsumption}"
         }.mkString("")
+        if (rendered.isEmpty) "empty" else rendered

Review Comment:
   `WorkerInfo.toString` now filters out zero-usage `ResourceConsumption` 
entries (via `resourceConsumption.isEmpty`), but the existing `WorkerInfoSuite` 
"WorkerInfo toString output" test only covers `null`/empty maps and a non-empty 
consumption case. Consider adding a unit test where `userResourceConsumption` 
contains users mapped to `ResourceConsumption(0,0,0,0)` and assert the output 
falls back to `"empty"` (and/or omits those users) to prevent regressions in 
this user-facing string output.



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

Reply via email to