This is an automated email from the ASF dual-hosted git repository. gurwls223 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 ba0e09830757 [SPARK-45899][CONNECT] Set errorClass in errorInfoToThrowable ba0e09830757 is described below commit ba0e098307573bbbba24e8afb992baee9f9bdbed Author: Yihong He <heyihong...@gmail.com> AuthorDate: Mon Nov 13 08:46:14 2023 +0900 [SPARK-45899][CONNECT] Set errorClass in errorInfoToThrowable ### What changes were proposed in this pull request? - Set errorClass in errorInfoToThrowable ### Why are the changes needed? - errorClass should be set even when error enrichment is not working ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? `build/sbt "connect-client-jvm/testOnly *ClientE2ETestSuite"` ### Was this patch authored or co-authored using generative AI tooling? No Closes #43772 from heyihong/SPARK-45899. Authored-by: Yihong He <heyihong...@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls...@apache.org> --- .../org/apache/spark/sql/ClientE2ETestSuite.scala | 1 + .../connect/client/GrpcExceptionConverter.scala | 24 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala index 10c928f13041..ee238c5492f9 100644 --- a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala +++ b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala @@ -85,6 +85,7 @@ class ClientE2ETestSuite extends RemoteSparkSession with SQLHelper with PrivateM |""".stripMargin) .collect() } + assert(ex.getErrorClass != null) if (enrichErrorEnabled) { assert(ex.getCause.isInstanceOf[DateTimeException]) } else { diff --git a/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala b/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala index 73e2db2f4ac7..f4254c75a2a8 100644 --- a/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala +++ b/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala @@ -168,7 +168,7 @@ private[client] object GrpcExceptionConverter { private[client] case class ErrorParams( message: String, cause: Option[Throwable], - // errorClass will only be set if the error is both enriched and SparkThrowable. + // errorClass will only be set if the error is SparkThrowable. errorClass: Option[String], // messageParameters will only be set if the error is both enriched and SparkThrowable. messageParameters: Map[String, String], @@ -357,14 +357,20 @@ private[client] object GrpcExceptionConverter { implicit val formats = DefaultFormats val classes = JsonMethods.parse(info.getMetadataOrDefault("classes", "[]")).extract[Array[String]] - - errorsToThrowable( - 0, - Seq( - FetchErrorDetailsResponse.Error + val errorClass = info.getMetadataOrDefault("errorClass", null) + val builder = FetchErrorDetailsResponse.Error + .newBuilder() + .setMessage(message) + .addAllErrorTypeHierarchy(classes.toImmutableArraySeq.asJava) + + if (errorClass != null) { + builder.setSparkThrowable( + FetchErrorDetailsResponse.SparkThrowable .newBuilder() - .setMessage(message) - .addAllErrorTypeHierarchy(classes.toImmutableArraySeq.asJava) - .build())) + .setErrorClass(errorClass) + .build()) + } + + errorsToThrowable(0, Seq(builder.build())) } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org