pingedbrain commented on PR #60311:
URL: https://github.com/apache/spark/pull/60311#issuecomment-6783541861
Following up on the cc. I did a full pass over the PR at d6ec2194 (after
agent support was removed) and ran it.
**How I tested it.** Ran `pyspark.sql.tests.test_ai_query` (18 tests, all
pass, including the Arrow one on a real session). Then wrote reproductions
against the PR code: the real `requests` stack against a local counting HTTP
server, a real boto3 client with a `Stubber`, and a `local[2,4]` SparkSession.
The Databricks SDK constructor is bypassed the same way `AIQuerySparkTests`
does; no live Databricks or Bedrock endpoint was called. JVM was a master build
from Nov 6.
**What held up.** No secrets are pickled into the UDF closure, redirects are
disabled, Databricks HTTP errors are sanitized, and error conditions match
their raise sites. `limit(1).collect()` and `take(1)` issue exactly 1 request.
**What I reproduced, most significant first:**
1. **`show()` bills the whole batch.** `show(5)` on a 5000-row partition
issued 5000 requests: `_query_batches` invokes the full Arrow batch before
yielding.
2. **A deterministic 4xx is retried by the task.** 300 rows with one
returning HTTP 400: the job failed after 640 requests (4 attempts x 160).
Nothing is returned for the rows that succeeded.
3. **A `close()` error fails a successful task.** 50 calls returned 200,
then the generator raised the close error, which makes Spark recompute and
re-send.
4. **Bedrock errors are unmapped.** A stubbed `AccessDeniedException`
surfaces as a raw botocore error with the caller ARN in the message, not
`AI_QUERY_INVOCATION_FAILED.*`.
5. **Non-string input fails at execution.** `ai_query("m", "id")` on a
bigint column builds and analyzes fine, then fails with `NOT_EXPECTED_TYPE`
mid-job.
6. **`Retry-After` beyond the budget becomes `TIMEOUT`.** 429 with
`Retry-After: 3600` and `timeout=2`: one request, a 2.0 s sleep, then
`TIMEOUT`; the 429 is lost.
7. **Re-registering an alias replaces it silently.** `_endpoints` is a
module-level dict, shared by every session in the process.
8. **`test_batch_order_nulls_concurrency_and_cleanup` is flaky.**
`AssertionError: 1 != 2` in 1 of 400 runs idle and 5 of 400 under CPU load.
Happy to share the reproduction scripts.
--
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]