You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/23 02:04:54 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #38685: [SPARK-41206][SQL] Rename the error class `_LEGACY_ERROR_TEMP_1233` to `COLUMN_ALREADY_EXISTS`

HyukjinKwon commented on code in PR #38685:
URL: https://github.com/apache/spark/pull/38685#discussion_r1029966254


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala:
##########
@@ -1759,24 +1763,25 @@ class DataFrameSuite extends QueryTest
 
   test("SPARK-8072: Better Exception for Duplicate Columns") {
     // only one duplicate column present
-    val e = intercept[org.apache.spark.sql.AnalysisException] {
+    val e = intercept[AnalysisException] {
       Seq((1, 2, 3), (2, 3, 4), (3, 4, 5)).toDF("column1", "column2", "column1")
         .write.format("parquet").save("temp")
     }
-    assert(e.getMessage.contains("Found duplicate column(s) when inserting into"))
-    assert(e.getMessage.contains("column1"))
-    assert(!e.getMessage.contains("column2"))
+    checkError(
+      exception = e,
+      errorClass = "COLUMN_ALREADY_EXISTS",
+      parameters = Map("columnName" -> "`column1`"))

Review Comment:
   Several tests fixed here seem flaky because of the order in the map, e.g.:
   
   ```
   2022-11-22T20:16:18.0679384Z [info] - SPARK-8072: Better Exception for Duplicate Columns *** FAILED *** (42 milliseconds)
   2022-11-22T20:16:18.0680329Z [info]   Map("columnName" -> "`column3`") did not equal Map("columnName" -> "`column1`") (SparkFunSuite.scala:317)
   2022-11-22T20:16:18.0680867Z [info]   Analysis:
   2022-11-22T20:16:18.0681437Z [info]   JavaCollectionWrappers$JMapWrapper(columnName: `column3` -> `column1`)
   2022-11-22T20:16:18.0682045Z [info]   org.scalatest.exceptions.TestFailedException:
   2022-11-22T20:16:18.0682715Z [info]   at org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
   2022-11-22T20:16:18.0683422Z [info]   at org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
   2022-11-22T20:16:18.0684101Z [info]   at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
   2022-11-22T20:16:18.0684760Z [info]   at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
   2022-11-22T20:16:18.0685415Z [info]   at org.apache.spark.SparkFunSuite.checkError(SparkFunSuite.scala:317)
   2022-11-22T20:16:18.0686092Z [info]   at org.apache.spark.sql.DataFrameSuite.$anonfun$new$368(DataFrameSuite.scala:1781)
   2022-11-22T20:16:18.0686748Z [info]   at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
   2022-11-22T20:16:18.0687352Z [info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
   2022-11-22T20:16:18.0687936Z [info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
   2022-11-22T20:16:18.0688514Z [info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
   2022-11-22T20:16:18.0689084Z [info]   at org.scalatest.Transformer.apply(Transformer.scala:22)
   2022-11-22T20:16:18.0689662Z [info]   at org.scalatest.Transformer.apply(Transformer.scala:20)
   2022-11-22T20:16:18.0690294Z [info]   at org.scalatest.funsuite.AnyFunSuiteLike$$anon$1.apply(AnyFunSuiteLike.scala:226)
   2022-11-22T20:16:18.0690957Z [info]   at org.apache.spark.SparkFunSuite.withFixture(SparkFunSuite.scala:207)
   2022-11-22T20:16:18.0691669Z [info]   at org.scalatest.funsuite.AnyFunSuiteLike.invokeWithFixture$1(AnyFunSuiteLike.scala:224)
   ```
   
   https://github.com/apache/spark/actions/runs/3525051044/jobs/5911287739 and https://github.com/apache/spark/actions/runs/3526328003 which happens in a different JDK or Scala version.



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