[SPARK-58386][SS] Restore backward compatibility of SupportsRealTimeRead.nextWithTimeout - #57580
Open
eason-yuchen-liu wants to merge 1 commit into
Open
Conversation
…ead.nextWithTimeout ### What changes were proposed in this pull request? Restore the single-argument `nextWithTimeout(Long timeoutMs)` method on the `@Evolving` `SupportsRealTimeRead` interface, which SPARK-55699 replaced with `nextWithTimeout(Long startTimeMs, Long timeoutMs)`. Both overloads are now `default` methods: - `nextWithTimeout(Long)` throws `UnsupportedOperationException` by default. - `nextWithTimeout(Long, Long)` delegates to `nextWithTimeout(Long)` by default, ignoring `startTimeMs`. A source overrides whichever one it needs. The engine always invokes the two-argument overload, so a source that overrides only the single-argument variant (as external 4.1-era sources do) is driven through the delegation. ### Why are the changes needed? SPARK-55699 changed the sole abstract method on the public interface rather than adding an overload, which is a source- and binary-incompatible break. An external source (a custom MQTT Real-Time Mode connector) that implemented `nextWithTimeout(Long)` no longer compiles or links after upgrading from Spark 4.1 to 4.2. The `startTimeMs` parameter is only needed for the manual-clock/test path, so it should not be forced on external implementors. ### Does this PR introduce _any_ user-facing change? Yes. It restores the Spark 4.1 `nextWithTimeout(Long)` method on the `SupportsRealTimeRead` interface, so external sources written against Spark 4.1 compile and link again. ### How was this patch tested? Verified locally that a Real-Time Mode source implementing only the single-argument `nextWithTimeout(Long)` is driven correctly end-to-end by a streaming query through the two-argument default delegation, and that existing RTM suites (`StreamRealTimeModeSuite`, `StreamRealTimeModeWithManualClockSuite`, `StreamRealTimeModeE2ESuite`) continue to pass. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.8) Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Restore the single-argument
nextWithTimeout(Long timeoutMs)method on the@EvolvingSupportsRealTimeReadinterface, which SPARK-55699 replaced withnextWithTimeout(Long startTimeMs, Long timeoutMs). Both overloads are nowdefaultmethods:nextWithTimeout(Long)throwsUnsupportedOperationExceptionby default.nextWithTimeout(Long, Long)delegates tonextWithTimeout(Long)by default, ignoringstartTimeMs.A source overrides whichever one it needs. The engine always invokes the two-argument overload, so a source that overrides only the single-argument variant (as external Spark 4.1-era sources do) is driven through the delegation. Internal implementors (
LowLatencyMemoryStream, Kafka) already override the two-argument variant and are unchanged.Why are the changes needed?
SPARK-55699 changed the sole abstract method on the public interface rather than adding an overload, which is a source- and binary-incompatible break. An external source (a custom MQTT Real-Time Mode connector) that implemented
nextWithTimeout(Long)no longer compiles or links after upgrading from Spark 4.1 to 4.2. ThestartTimeMsparameter is only needed for the manual-clock/test path, so it should not be forced on external implementors.Does this PR introduce any user-facing change?
Yes. It restores the Spark 4.1
nextWithTimeout(Long)method on theSupportsRealTimeReadinterface, so external sources written against Spark 4.1 compile and link again.How was this patch tested?
Verified locally that a Real-Time Mode source implementing only the single-argument
nextWithTimeout(Long)is driven correctly end-to-end by a streaming query through the two-argument default delegation, and that existing RTM suites (StreamRealTimeModeSuite,StreamRealTimeModeWithManualClockSuite,StreamRealTimeModeE2ESuite) continue to pass.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)