HyukjinKwon opened a new pull request, #358:
URL: https://github.com/apache/spark-connect-rust/pull/358

   ### What changes were proposed in this pull request?
   
   [SPARK-61168](https://issues.apache.org/jira/browse/SPARK-61168): PySpark 
Connect builds the exception of an error of the server as it handles the gRPC 
error of the call, a `grpc` `_MultiThreadedRendezvous`, and raises it from 
`None`. So when the error has a DataFrame or SQL query context, the 
`DataFrameQueryContextLogger` and `SQLQueryContextLogger` of `pyspark.logger` 
log that gRPC error as the exception of their record:
   - its class
   - its `str`, of the status and the details (the message of the server)
   - its traceback
   
   The client builds the exception in Rust, where no Python exception is 
handled. Its loggers now log as PySpark Connect's do: an exception of a query 
context logs as it handles a stand-in of that gRPC error, a 
`_MultiThreadedRendezvous` of `pyspark.errors.exceptions.connect`. The stand-in 
has:
   - the status code and message of the error
   - the `str` of `grpc`'s, `<_MultiThreadedRendezvous of RPC that terminated 
with: status = ..., details = "...", debug_error_string = "...">`
   
   The exception is raised from it (`__context__`, `__suppress_context__`), as 
PySpark Connect's. The `debug_error_string` has no address of the peer, which 
the client does not have in Python, and the traceback is of where the exception 
is built.
   
   ### Why are the changes needed?
   
   The loggers logged an exception of class `UnknownException`, of msg `None`, 
with no stacktrace. Apache Spark's `test_dataframe_query_context_logger` of 
`test_parity_logger.py` failed on this client (`err_msg in 
log_json["exception"]["msg"]`).
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The records of the query context loggers have the exception of PySpark 
4.3.0's records.
   
   ### How was this patch tested?
   
   - A new offline test builds the exception of an error of the server, of a 
DataFrame query context, and checks the record of the 
`DataFrameQueryContextLogger`: its context, and the class, `str` and stacktrace 
of its exception. It also checks the `__context__` of the exception. It fails 
without this change.
   - The record of a division by zero of a DataFrame against a local server is 
that of official PySpark 4.3.0, but for the address of the peer and the frames 
of the stacktrace.
   - Apache Spark's `test_parity_logger.py` passes on this client against a 
local server, all 11 tests. So do `test_parity_traceback.py`, 
`test_parity_errors.py` and `test_parity_dataframe_query_context.py`.
   - The lib tests of both crates (597 passed), the build of all tests, also 
with `wasm-udf`, the offline Python suites (2223 passed, 8 skipped), and the 
live drop-in and Arrow suites (206 passed) and live cases (10 passed) against a 
local Spark 4.3.0 server. Clippy reports no diagnostics in the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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]

Reply via email to