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

   ### What changes were proposed in this pull request?
   
   A follow-up of SPARK-62114 (#898), which made the Python client read the 
attributes of a `SparkConnectClient` again at the end of a nested call, before 
the requests of a call's failure, and before the interrupt of a Ctrl-C:
   
   - An exception that is not an `Exception`, raised by such a read, such as 
the `KeyboardInterrupt` of a Ctrl-C or the `SystemExit` of a SIGTERM handler 
that comes then, is raised at once, by the call whose read it was.
     - At the end of a nested call, the nested call raises it, so a Ctrl-C 
interrupts the execution of the enclosing call at once, as in PySpark.
     - After a finalizer's request, the enclosing call takes it at its next 
poll of signals, as a signal handler's exception.
     - Before the requests of a failure, it replaces the error of the call.
     It was raised again as a new SIGINT, or reported as unraisable, so a 
`SystemExit` of the read before the details of a failure was lost, and a Ctrl-C 
there waited for the enclosing call to end. An exception that no call can take 
is reported as unraisable, as in a `__del__`.
   - The read before the requests of a call's failure, the details of its error 
and the configs of its stack trace, reads the extensions strictly, as PySpark's 
`_fetch_enriched_error` builds its request.
     - An extension that is not an `Any` raises protobuf's `TypeError` in place 
of the server's error, of the server's error as its context, and neither 
request is sent.
     - A failure that the call handles itself, such as the lookup of the plan 
compression, drops it, as PySpark's `except Exception` does.
     - The doc-hidden `set_failure_requests_hook` of the core takes a function 
of the client and of the server's error that returns whether the read succeeded.
   - A failure to build the interrupt of a Ctrl-C replaces it, of the 
`KeyboardInterrupt` as its context, and no interrupt is sent.
   - The `KeyboardInterrupt` of a progress handler interrupts the execution on 
the server, as PySpark's `except KeyboardInterrupt` does: of the execution's 
client, so of a copy's attributes for a copy's execution.
   
   ### Why are the changes needed?
   
   To close these differences from PySpark (the review of SPARK-62114).
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, as above. What remains is documented in 
`dev/parity/known-differences.md`:
   - an exception that the attributes raise themselves, not a signal, in the 
read at the end of a nested call, is raised by the nested call, where PySpark 
reads nothing there;
   - the interrupt of a progress handler is sent before the done call, where 
PySpark's is sent after.
   
   ### How was this patch tested?
   
   - New tests in `python/tests/test_dropin_offline.py`, which fail without the 
change, also of a real SIGINT during a nested call against the mock server.
   - Four rounds of an independent review. It compared the requests, errors and 
timings of the drop-in and of PySpark 4.3.0 through a recording proxy and a 
fault proxy:
     - `SystemExit` and `KeyboardInterrupt` in each read, and real Ctrl-C and 
SIGTERM in each kind of call and during nested calls;
     - invalid extensions of a copy and of the session;
     - progress handlers, finalizers and threads;
     - leaks of the kept errors.
   - The core tests (release and debug), wasm, clippy, rustdoc, the stubs, the 
native server's crates, the offline suite in sorted order and under coverage, 
and the live e2e with and without protobuf.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code
   
   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