HyukjinKwon opened a new pull request, #203: URL: https://github.com/apache/spark-connect-rust/pull/203
### What changes were proposed in this pull request? [SPARK-61001](https://issues.apache.org/jira/browse/SPARK-61001): `DataFrame.toLocalIterator()` now raises the error of an execution that fails while it is iterated, as PySpark does, with or without `prefetchPartitions`. The error ends the iteration, as it ends PySpark's generator. PySpark's `toLocalIterator` is a generator, so the execution starts with the first row rather than with the call. Ours now does the same: an error of the execution, such as an analysis error, is raised by the iteration too, and an iterator that is never read executes nothing. ### Why are the changes needed? The iteration ended without an error, so the rows of a failing query looked complete. For `spark.sql("SELECT assert_true(id < 0) AS x FROM range(3)")`, `list(df.toLocalIterator())` raises `SparkRuntimeException` `USER_RAISED_EXCEPTION` in PySpark 4.3.0, and was `[]` here. ### Does this PR introduce _any_ user-facing change? Yes, `toLocalIterator()` raises the errors of PySpark 4.3.0, and executes with its first row. ### How was this patch tested? - A new live test checks the error of a failing query, with and without prefetching, and the end of the iteration after it. It also passes with official PySpark 4.3.0, and fails without this change. - A new offline test checks, against a mock Connect server, that `toLocalIterator()` sends no request until the first row, which raises the error of a failing `ExecutePlan`, and that the iteration then ends. - The lib tests and every integration test, e2e included, against a local Spark 4.3.0 server (660 passed, and 123 of the transport crate), the build of all tests with `wasm-udf`, the offline Python suites (911 passed, 9 skipped), and the live drop-in and Arrow suites (84 passed) and live cases (10 passed). 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]
