This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 9b927449825a [SPARK-53003][CORE][FOLLOWUP] Handle null input values
9b927449825a is described below
commit 9b927449825aced7b1431d63b754df5e73c096b9
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Tue Jul 29 22:14:06 2025 -0700
[SPARK-53003][CORE][FOLLOWUP] Handle null input values
### What changes were proposed in this pull request?
This PR aims to handle null input values in `strip` method as a follow-up
of the following to address the review comment.
- https://github.com/apache/spark/pull/51710
### Why are the changes needed?
To be more robust.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass the CIs.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #51716 from dongjoon-hyun/SPARK-53003-2.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/common/utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala
b/common/utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala
index 9cf4b7ff6a91..dbe7d78937e9 100644
--- a/common/utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala
+++ b/common/utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala
@@ -70,7 +70,8 @@ private[spark] trait SparkStringUtils {
}
/** Try to strip prefix and suffix with the given string 's' */
- def strip(str: String, s: String): String = str.stripPrefix(s).stripSuffix(s)
+ def strip(str: String, s: String): String =
+ if (str == null || s == null) str else str.stripPrefix(s).stripSuffix(s)
}
private[spark] object SparkStringUtils extends SparkStringUtils with Logging {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]