allisonwang-db commented on code in PR #40575:
URL: https://github.com/apache/spark/pull/40575#discussion_r1154486470
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectService.scala:
##########
@@ -109,23 +118,41 @@ class SparkConnectService(debug: Boolean)
*/
private def handleError[V](
opType: String,
- observer: StreamObserver[V]): PartialFunction[Throwable, Unit] = {
- case se: SparkException if isPythonExecutionException(se) =>
- logError(s"Error during: $opType", se)
- observer.onError(
-
StatusProto.toStatusRuntimeException(buildStatusFromThrowable(se.getCause)))
-
- case e: Throwable if e.isInstanceOf[SparkThrowable] || NonFatal.apply(e) =>
- logError(s"Error during: $opType", e)
-
observer.onError(StatusProto.toStatusRuntimeException(buildStatusFromThrowable(e)))
-
- case e: Throwable =>
- logError(s"Error during: $opType", e)
- observer.onError(
- Status.UNKNOWN
- .withCause(e)
- .withDescription(StringUtils.abbreviate(e.getMessage, 2048))
- .asRuntimeException())
+ observer: StreamObserver[V],
+ userId: String,
+ sessionId: String): PartialFunction[Throwable, Unit] = {
+ val session =
+ SparkConnectService
+ .getOrCreateIsolatedSession(userId, sessionId)
+ .session
+ val stackTraceEnabled = try {
+ session.conf.get(
+
org.apache.spark.sql.internal.SQLConf.PYSPARK_JVM_STACKTRACE_ENABLED.key).toBoolean
+ } catch {
+ case NonFatal(_) => true
+ }
+
+ {
Review Comment:
Do you mean the try-catch block or the partial function block?
--
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]