From 6224d64d2903e7b6c37654d0446ea53d8d1cf281 Mon Sep 17 00:00:00 2001 From: Nemanja Boric Date: Wed, 3 Apr 2024 10:13:28 +0200 Subject: [PATCH] [SPARK-47708][CONNECT] Do not log gRPC exception to stderr in PySpark Currently if there's any gRPC exception, instead of just handling it, the PySpark's gRPC error handler is going to print it out to the stderr, not allowing the user to cleanly ignore the exception by using try/except control flow statement. In this PR we are removing the logger.exception call and we rely on the downstream exception mechanism to report this to the user. --- python/pyspark/sql/connect/client/core.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/pyspark/sql/connect/client/core.py b/python/pyspark/sql/connect/client/core.py index 2a1f25d83f47c..4595a61aaab2c 100644 --- a/python/pyspark/sql/connect/client/core.py +++ b/python/pyspark/sql/connect/client/core.py @@ -1632,7 +1632,6 @@ def _handle_rpc_error(self, rpc_error: grpc.RpcError) -> NoReturn: ------- Throws the appropriate internal Python exception. """ - logger.exception("GRPC Error received") # We have to cast the value here because, a RpcError is a Call as well. # https://grpc.github.io/grpc/python/grpc.html#grpc.UnaryUnaryMultiCallable.__call__ status = rpc_status.from_call(cast(grpc.Call, rpc_error))