You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "amaliujia (via GitHub)" <gi...@apache.org> on 2023/08/02 20:17:16 UTC
[GitHub] [spark] amaliujia commented on a diff in pull request #42266: [SPARK-44575][SQL][CONNECT] Implement basic error translation
amaliujia commented on code in PR #42266:
URL: https://github.com/apache/spark/pull/42266#discussion_r1282376757
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala:
##########
@@ -47,11 +52,37 @@ private[client] object GrpcExceptionConverter {
}
}
- private def toSparkThrowable(ex: StatusRuntimeException): SparkThrowable with Throwable = {
+ private val errorFactory = new ErrorFactoryBuilder()
+ .addConstructor((message, _) => new ParseException(None, message, Origin(), Origin()))
+ .addConstructor((message, _) => new AnalysisException(message))
+ .build()
+
+ private def errorInfoToThrowable(info: ErrorInfo, message: String): Throwable = {
+ val classes =
+ mapper.readValue(info.getMetadataOrDefault("classes", "[]"), classOf[Array[String]])
+
+ for (cls <- classes) {
+ errorFactory.get(cls) match {
+ case Some(constructor) =>
+ return constructor(message, null)
+ case None =>
+ // Do nothing
Review Comment:
Will we ever hit this?
--
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