This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 9291293 [SPARK-55900] Simplify `SparkAppStatusUtils` by adjusting
`import` statements
9291293 is described below
commit 92912934711c9f7b702f6cf3a6f5e27109c49e47
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Mon Mar 9 16:41:15 2026 -0700
[SPARK-55900] Simplify `SparkAppStatusUtils` by adjusting `import`
statements
### What changes were proposed in this pull request?
This PR uses static imports for `Constants.*` and
`ApplicationStateSummary.*` in `SparkAppStatusUtils` to simplify the code.
### Why are the changes needed?
To improve code readability by removing repetitive class name prefixes.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass the CIs because this is a refactoring-only change with no behavioral
impact.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-6)
Closes #541 from dongjoon-hyun/SPARK-55900.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../k8s/operator/utils/SparkAppStatusUtils.java | 23 +++++++++-------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/SparkAppStatusUtils.java
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/SparkAppStatusUtils.java
index 576c704..841a0ba 100644
---
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/SparkAppStatusUtils.java
+++
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/SparkAppStatusUtils.java
@@ -19,10 +19,11 @@
package org.apache.spark.k8s.operator.utils;
-import org.apache.spark.k8s.operator.Constants;
+import static org.apache.spark.k8s.operator.Constants.*;
+import static org.apache.spark.k8s.operator.status.ApplicationStateSummary.*;
+
import org.apache.spark.k8s.operator.SparkApplication;
import org.apache.spark.k8s.operator.status.ApplicationState;
-import org.apache.spark.k8s.operator.status.ApplicationStateSummary;
/** Handy utils for create and manage Application Status. */
public final class SparkAppStatusUtils {
@@ -48,8 +49,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for driver unexpected removal.
*/
public static ApplicationState driverUnexpectedRemoved() {
- return new ApplicationState(
- ApplicationStateSummary.Failed,
Constants.DRIVER_UNEXPECTED_REMOVED_MESSAGE);
+ return new ApplicationState(Failed, DRIVER_UNEXPECTED_REMOVED_MESSAGE);
}
/**
@@ -58,8 +58,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for driver launch timeout.
*/
public static ApplicationState driverLaunchTimedOut() {
- return new ApplicationState(
- ApplicationStateSummary.DriverStartTimedOut,
Constants.DRIVER_LAUNCH_TIMEOUT_MESSAGE);
+ return new ApplicationState(DriverStartTimedOut,
DRIVER_LAUNCH_TIMEOUT_MESSAGE);
}
/**
@@ -68,8 +67,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for driver ready timeout.
*/
public static ApplicationState driverReadyTimedOut() {
- return new ApplicationState(
- ApplicationStateSummary.DriverReadyTimedOut,
Constants.DRIVER_LAUNCH_TIMEOUT_MESSAGE);
+ return new ApplicationState(DriverReadyTimedOut,
DRIVER_LAUNCH_TIMEOUT_MESSAGE);
}
/**
@@ -78,8 +76,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for executor launch timeout.
*/
public static ApplicationState executorLaunchTimedOut() {
- return new ApplicationState(
- ApplicationStateSummary.ExecutorsStartTimedOut,
Constants.EXECUTOR_LAUNCH_TIMEOUT_MESSAGE);
+ return new ApplicationState(ExecutorsStartTimedOut,
EXECUTOR_LAUNCH_TIMEOUT_MESSAGE);
}
/**
@@ -88,8 +85,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for application cancellation.
*/
public static ApplicationState appCancelled() {
- return new ApplicationState(
- ApplicationStateSummary.ResourceReleased,
Constants.APP_CANCELLED_MESSAGE);
+ return new ApplicationState(ResourceReleased, APP_CANCELLED_MESSAGE);
}
/**
@@ -98,8 +94,7 @@ public final class SparkAppStatusUtils {
* @return An ApplicationState object for exceeding retain duration.
*/
public static ApplicationState appExceededRetainDuration() {
- return new ApplicationState(
- ApplicationStateSummary.ResourceReleased,
Constants.APP_EXCEEDED_RETAIN_DURATION_MESSAGE);
+ return new ApplicationState(ResourceReleased,
APP_EXCEEDED_RETAIN_DURATION_MESSAGE);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]