AlejandroMorgante opened a new pull request, #60230:
URL: https://github.com/apache/spark/pull/60230

   ### What changes were proposed in this pull request?
   `awaitTermination`/`awaitAnyTermination` (classic and Connect) convert a 
`timeout` in seconds to milliseconds with `int()`, which truncates. A tiny but 
positive timeout like `0.0001` seconds rounds down to `0`ms. This PR uses 
`math.ceil()` instead, so any positive timeout becomes at least `1`ms.
   
   ### Why are the changes needed?
   Some backends reject a `0`ms timeout outright as "has to be positive", 
surprising a caller who never asked for `0` -- they passed a small positive 
value and got an error about a value they didn't pass. Split out of #60228 
(which covers a separate, unrelated bug in the same validation code) after 
review there pointed out this is a qualitatively different change: actual 
runtime behavior for valid timeouts, not just an error message for invalid ones.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Before, `awaitTermination(0.0001)` silently became a `0`ms wait. After, 
it's `1`ms. Timeouts with no meaningful sub-millisecond remainder (the common 
case, e.g. `5`, `2.6`) are unaffected.
   
   ### How was this patch tested?
   Added 4 tests 
(`test_streaming_query_validation.StreamingQueryTimeoutRoundingTests`, classic 
+ Connect, the Connect ones guarded by `should_test_connect`), substituting a 
fake JVM/Connect handle and asserting the exact millisecond value it receives 
for a `0.0001` timeout. No `SparkSession` needed. Also manually verified normal 
values round-trip unchanged. Verified locally with `python -m unittest` and 
`ruff check`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Yes. Generated-by: Claude Code (Claude Sonnet 5)
   
   ---
   This contribution is my original work and I license the work to the project 
under the project's open source license.
   
   (First-time contributors here, still learning the contribution flow — happy 
to adjust anything that's off.)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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