You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2024/01/02 07:00:05 UTC

[PR] [SPARK-46561][CORE][WEBUI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

LuciferYang opened a new pull request, #44556:
URL: https://github.com/apache/spark/pull/44556

   ### What changes were proposed in this pull request?
   This pr just change to use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala`:
   
   ```scala
   state.workers.filter(_.resourcesInfoUsed.nonEmpty).nonEmpty
   ```
   
   to
   
   ```scala
   state.workers.exists(_.resourcesInfoUsed.nonEmpty)
   ```
   
   ### Why are the changes needed?
   Simplify the code: compared to `filter + nonEmpty`, using `exists` has the opportunity to terminate the iteration over the collection early.
   
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Pass GitHub Actions
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #44556:
URL: https://github.com/apache/spark/pull/44556#issuecomment-1873685477

   Yes, only one case. If feel it's not worth replacing, let's just leave it as it is


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44556:
URL: https://github.com/apache/spark/pull/44556#issuecomment-1873678461

   I'm not sure if this is worthy of any action.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44556:
URL: https://github.com/apache/spark/pull/44556#issuecomment-1873677946

   Do you mean this is the only instance?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang closed pull request #44556: [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala`
URL: https://github.com/apache/spark/pull/44556


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][CORE][WEBUI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #44556:
URL: https://github.com/apache/spark/pull/44556#discussion_r1439192898


##########
core/src/main/scala/org/apache/spark/deploy/master/ui/MasterPage.scala:
##########
@@ -98,7 +98,7 @@ private[ui] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
   def render(request: HttpServletRequest): Seq[Node] = {
     val state = getMasterState
 
-    val showResourceColumn = state.workers.filter(_.resourcesInfoUsed.nonEmpty).nonEmpty
+    val showResourceColumn = state.workers.exists(_.resourcesInfoUsed.nonEmpty)

Review Comment:
   cc @dongjoon-hyun 



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46561][UI] Use `exists` instead of `filter + nonEmpty` to check `showResourceColumn` in `MasterPage.scala` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #44556:
URL: https://github.com/apache/spark/pull/44556#issuecomment-1873695112

   Let me close this one


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org