From 58ec9feecf4428e84921e64e6af94cbb3904b0df Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Tue, 10 Sep 2024 18:07:58 +0200 Subject: [PATCH] [SPARK-49579][SQL][TESTS][FOLLOWUP] Use `condition` instead of `errorClass` in `SparkThrowableSuite` and in `DateTimeFormatterHelperSuite` ### What changes were proposed in this pull request? In the PR, I propose to use `condition` instead of `errorClass` in two test suites: - SparkThrowableSuite - DateTimeFormatterHelperSuite ### Why are the changes needed? Because the changes from the PR https://github.com/apache/spark/pull/48027 conflict to https://github.com/apache/spark/pull/48058 and https://github.com/apache/spark/pull/48026, and tests in #48027 were passed earlier than the last PRs were merged to master. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? By compiling and running the following tests locally: ``` $ build/sbt "test:testOnly *org.apache.spark.sql.catalyst.util.DateTimeFormatterHelperSuite" $ build/sbt "test:testOnly *SparkThrowableSuite" ``` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #48061 from MaxGekk/fix-missing-errorClass. Authored-by: Max Gekk Signed-off-by: Max Gekk --- core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala | 2 +- .../spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala index 2229f78fe2a93..946ea75686e32 100644 --- a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala +++ b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala @@ -518,7 +518,7 @@ class SparkThrowableSuite extends SparkFunSuite { "details" -> "implicit cast" )) }, - errorClass = "INTERNAL_ERROR", + condition = "INTERNAL_ERROR", parameters = Map( "message" -> ("Found unused message parameters of the error class 'CANNOT_UP_CAST_DATATYPE'. " + diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala index ba56ba19a00f8..095dc3869571d 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala @@ -90,7 +90,7 @@ class DateTimeFormatterHelperSuite extends SparkFunSuite { exception = intercept[SparkIllegalArgumentException] { createBuilderWithVarLengthSecondFraction(pattern) }, - errorClass = "INVALID_DATETIME_PATTERN.SECONDS_FRACTION", + condition = "INVALID_DATETIME_PATTERN.SECONDS_FRACTION", parameters = Map("pattern" -> pattern)) } }