This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new d87ac8ef49db [SPARK-47708][CONNECT] Do not log gRPC exception to 
stderr in PySpark
d87ac8ef49db is described below

commit d87ac8ef49dbd7a14d7a774b4ace1ab681a1bb01
Author: Nemanja Boric <nemanja.bo...@databricks.com>
AuthorDate: Thu Apr 4 10:28:34 2024 +0900

    [SPARK-47708][CONNECT] Do not log gRPC exception to stderr in PySpark
    
    ### What changes were proposed in this pull request?
    
    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.
    
    ### Why are the changes needed?
    
    Without this change, there's no way that the user ignores the gRPC error 
without piping the stderr to /dev/null or equivalent.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, the stderr will not have the exception trace written twice.
    
    ### How was this patch tested?
    
    Existing tests.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #45840 from nemanja-boric-databricks/no-log.
    
    Authored-by: Nemanja Boric <nemanja.bo...@databricks.com>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 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 c8cf12f40708..b8ba8bd21dec 100644
--- a/python/pyspark/sql/connect/client/core.py
+++ b/python/pyspark/sql/connect/client/core.py
@@ -1668,7 +1668,6 @@ class SparkConnectClient(object):
         -------
         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))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to