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

   ### What changes were proposed in this pull request?
   `GroupState.setTimeoutTimestamp()` requires `EventTimeTimeout` to be 
enabled, but the
   `CANNOT_WITHOUT` error raised when it isn't copied `setTimeoutDuration()`'s 
message text
   verbatim: it told the user to "set timeout duration" and to enable 
"processing time timeout",
   instead of "set timeout timestamp" / "event time timeout". This PR fixes the
   `condition1`/`condition2` message parameters passed to `CANNOT_WITHOUT` in
   `setTimeoutTimestamp()`.
   
   ### Why are the changes needed?
   The wrong error text misguides users who hit this validation while using
   `applyInPandasWithState`: following the message's instructions (enabling 
processing time
   timeout) does not fix the actual problem, since `setTimeoutTimestamp` 
specifically requires
   event time timeout to be enabled instead.
   
   The mismatched text was already present in the original hardcoded 
`RuntimeError` message in
   the initial `GroupState`/`applyInPandasWithState` implementation, and was 
carried over
   unchanged when the error was later migrated to the structured 
`PySparkRuntimeError` /
   `CANNOT_WITHOUT` error condition (that migration PR is not at fault; it 
faithfully preserved
   the pre-existing text).
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, an error message correction. Before:
   ```
   Cannot set timeout duration without enabling processing time timeout in 
applyInPandasWithState.
   ```
   After:
   ```
   Cannot set timeout timestamp without enabling event time timeout in 
applyInPandasWithState.
   ```
   No other behavior change: same error condition (`CANNOT_WITHOUT`), same 
trigger, only the
   text is corrected.
   
   ### How was this patch tested?
   Added `pyspark.sql.tests.streaming.test_group_state.GroupStateTests
   .test_set_timeout_timestamp_requires_event_time_timeout`, which constructs 
`GroupState`
   directly (no `SparkSession` needed, since the check raises before touching 
any JVM state) and
   asserts the corrected `condition1`/`condition2` message parameters via 
`checkError`. Verified
   locally with `python -m unittest` and `ruff check`; the full 
`python/run-tests` / CI suite will
   run on this PR.
   
   ### 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.
   
   🤖 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