heyihong commented on code in PR #42266:
URL: https://github.com/apache/spark/pull/42266#discussion_r1282903796
##########
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:
Because the classes included both the class name and all its parental class
names of an exception. It is possible that the exact match does not happen.
--
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]