amaliujia commented on code in PR #42266:
URL: https://github.com/apache/spark/pull/42266#discussion_r1282378744
##########
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:
oh so this happens when there is nothing found from errorFactory so `do
nothing` here means `do not return` then it fall back to `new
SparkException(message)`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]