heyihong commented on code in PR #42471:
URL: https://github.com/apache/spark/pull/42471#discussion_r1295956355
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala:
##########
@@ -62,14 +63,20 @@ private[client] object GrpcExceptionConverter extends
JsonUtils {
}
private def errorConstructor[T <: Throwable: ClassTag](
- throwableCtr: (String, Throwable) => T): (String, (String, Throwable) =>
Throwable) = {
+ throwableCtr: (String, Option[Throwable]) => T)
+ : (String, (String, Option[Throwable]) => Throwable) = {
val className = implicitly[reflect.ClassTag[T]].runtimeClass.getName
(className, throwableCtr)
}
private val errorFactory = Map(
errorConstructor((message, _) => new ParseException(None, message,
Origin(), Origin())),
- errorConstructor((message, cause) => new AnalysisException(message, cause
= Option(cause))))
+ errorConstructor((message, cause) => new AnalysisException(message, cause
= cause)),
+ errorConstructor((message, _) => new
NamespaceAlreadyExistsException(message)),
Review Comment:
Yes, the current idea is to convert the common exceptions for better
compatibility with the existing control flow that catch exceptions from spark
sql.
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala:
##########
@@ -62,14 +63,20 @@ private[client] object GrpcExceptionConverter extends
JsonUtils {
}
private def errorConstructor[T <: Throwable: ClassTag](
- throwableCtr: (String, Throwable) => T): (String, (String, Throwable) =>
Throwable) = {
+ throwableCtr: (String, Option[Throwable]) => T)
+ : (String, (String, Option[Throwable]) => Throwable) = {
val className = implicitly[reflect.ClassTag[T]].runtimeClass.getName
(className, throwableCtr)
}
private val errorFactory = Map(
errorConstructor((message, _) => new ParseException(None, message,
Origin(), Origin())),
- errorConstructor((message, cause) => new AnalysisException(message, cause
= Option(cause))))
+ errorConstructor((message, cause) => new AnalysisException(message, cause
= cause)),
+ errorConstructor((message, _) => new
NamespaceAlreadyExistsException(message)),
Review Comment:
Yes, the current idea is to convert the common exceptions for better
compatibility with the existing control flows that catch exceptions from spark
sql.
--
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]