You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "uros-b (via GitHub)" <gi...@apache.org> on 2026/08/28 10:33:18 UTC

[PR] [SPARK-59079][CORE] Use Option.when in LiveEntity [spark]

uros-b opened a new pull request, #58381:
URL: https://github.com/apache/spark/pull/58381

   ### What changes were proposed in this pull request?
   
   `LiveEntity.scala` builds several `Option` values with the `if (cond) Some(x) else None` idiom. This replaces the five such occurrences with the more idiomatic `Option.when(cond)(x)`:
   
   - `firstTaskLaunchedTime` in `LiveStage`;
   - the four on-/off-heap memory fields in `LiveRDDDistribution` (each guarded by `exec.hasMemoryInfo`).
   
   ### Why are the changes needed?
   
   `Option.when` reads more directly than the `if`/`else` form and is already used across the codebase (e.g. `InjectRuntimeFilter`, `ParquetSchemaConverter`). This is a small readability cleanup.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. `Option.when(cond)(x)` evaluates its by-name value only when the condition holds, exactly like `if (cond) Some(x) else None`, so the produced `Option` values are identical.
   
   ### How was this patch tested?
   
   Existing tests. This is a behavior-preserving refactor; `core` compiles cleanly and its tests are unaffected.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


-- 
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-59079][CORE] Use Option.when in LiveEntity [spark]

Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b closed pull request #58381: [SPARK-59079][CORE] Use Option.when in LiveEntity
URL: https://github.com/apache/spark/pull/58381


-- 
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-59079][CORE] Use Option.when in LiveEntity [spark]

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

   Thank you @HyukjinKwon!


-- 
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-59079][CORE] Use Option.when in LiveEntity [spark]

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

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/7ff68edb6ff47a93d035c1546d60a857dea15078
   - merged into branch-4.x https://github.com/apache/spark/commit/6c0d11c1a9627d57a486ca02aaf0d339c0ccd6c9
   
   *Posted by `merge_spark_pr.py`*


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