heyihong commented on code in PR #42377:
URL: https://github.com/apache/spark/pull/42377#discussion_r1323025628


##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala:
##########
@@ -44,6 +45,53 @@ import org.apache.spark.sql.types._
 
 class ClientE2ETestSuite extends RemoteSparkSession with SQLHelper with 
PrivateMethodTester {
 
+  test("cause exceptions should work without error enrichment") {
+    withSQLConf("spark.sql.connect.enrichError.enabled" -> "false") {
+      val ex = intercept[SparkUpgradeException] {
+        spark
+          .sql("""
+            |select from_json(
+            |  '{"d": "02-29"}',
+            |  'd date',
+            |  map('dateFormat', 'MM-dd'))
+            |""".stripMargin)
+          .collect()
+      }
+      assert(ex.getCause.isInstanceOf[DateTimeException])
+    }
+  }
+
+  test("throw SparkException with large cause exception") {
+    val session = spark
+    import session.implicits._
+
+    val throwException =
+      udf((_: String) => throw new SparkException("test" * 10000))
+
+    val ex = intercept[SparkException] {
+      Seq("1").toDS.withColumn("udf_val", throwException($"value")).collect()
+    }
+
+    assert(ex.getCause.isInstanceOf[SparkException])
+    assert(ex.getCause.getMessage.contains("test" * 10000))

Review Comment:
   A message that includes big query plans?



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to