[SPARK-48567][SS][FOLLOWUP] StreamingQuery.lastProgress should return the actual StreamingQueryProgress #47470
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.
This reverts commit d067fc6, which reverted 042804a, essentially brings it back. 042804a failed the 3.5 client <> 4.0 server test, but the test was decided to turned off for cross-version test in #47468
What changes were proposed in this pull request?
This PR is created after discussion in this closed one: #46886
I was trying to fix a bug (in connect, query.lastProgress doesn't have
numInputRows,inputRowsPerSecond, andprocessedRowsPerSecond), and we reached the conclusion that what purposed in this PR should be the ultimate fix.In python, for both classic spark and spark connect, the return type of
lastProgressisDict(andrecentProgressisList[Dict]), but in scala it's the actualStreamingQueryProgressobject:spark/sql/core/src/main/scala/org/apache/spark/sql/streaming/StreamingQuery.scala
Lines 94 to 101 in 1a5d22a
This API discrepancy brings some confusion, like in Scala, users can do
query.lastProgress.batchId, while in Python they have to doquery.lastProgress["batchId"].This PR makes
StreamingQuery.lastProgressto return the actualStreamingQueryProgress(andStreamingQuery.recentProgressto returnList[StreamingQueryProgress]).To prevent breaking change, we extend
StreamingQueryProgressto be a subclass ofdict, so existing code accessing using dictionary method (e.g.query.lastProgress["id"]) is still functional.Why are the changes needed?
API parity
Does this PR introduce any user-facing change?
Yes, now
StreamingQuery.lastProgressreturns the actualStreamingQueryProgress(andStreamingQuery.recentProgressreturnsList[StreamingQueryProgress]).How was this patch tested?
Added unit test
Was this patch authored or co-authored using generative AI tooling?
No