From 32e73dd55416b3a0a81ea6b6635e6fedde378842 Mon Sep 17 00:00:00 2001 From: yangjie01 Date: Thu, 28 Mar 2024 07:37:01 -0700 Subject: [PATCH] [MINOR][CORE] Replace `get+getOrElse` with `getOrElse` with default value in `StreamingQueryException` ### What changes were proposed in this pull request? This PR replaces `get + getOrElse` with `getOrElse` with a default value in `StreamingQueryException`. ### Why are the changes needed? Simplify code ### 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 Closes #45753 from LuciferYang/minor-getOrElse. Authored-by: yangjie01 Signed-off-by: Dongjoon Hyun --- .../spark/sql/streaming/StreamingQueryException.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/utils/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryException.scala b/common/utils/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryException.scala index 800a6dcfda8d7..259f4330224c9 100644 --- a/common/utils/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryException.scala +++ b/common/utils/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryException.scala @@ -48,11 +48,11 @@ class StreamingQueryException private[sql]( errorClass: String, messageParameters: Map[String, String]) = { this( - messageParameters.get("queryDebugString").getOrElse(""), + messageParameters.getOrElse("queryDebugString", ""), message, cause, - messageParameters.get("startOffset").getOrElse(""), - messageParameters.get("endOffset").getOrElse(""), + messageParameters.getOrElse("startOffset", ""), + messageParameters.getOrElse("endOffset", ""), errorClass, messageParameters) }