-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-48567][SS] StreamingQuery.lastProgress should return the actual StreamingQueryProgress #46921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-48567][SS] StreamingQuery.lastProgress should return the actual StreamingQueryProgress #46921
Changes from 10 commits
c73ebfc
d967119
ef7a116
f8d7403
707d5bd
917adb6
cab14ac
8355342
b43dc96
984d00b
e51e1b1
b2cd7c9
4c8f01e
53afe51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -397,10 +397,13 @@ def errorClassOnException(self) -> Optional[str]: | |||
| return self._errorClassOnException | ||||
|
|
||||
|
|
||||
| class StreamingQueryProgress: | ||||
| class StreamingQueryProgress(dict): | ||||
| """ | ||||
| .. versionadded:: 3.4.0 | ||||
|
|
||||
| .. versionchanged:: 4.0.0 | ||||
| Becomes a subclass of dict | ||||
|
|
||||
| Notes | ||||
| ----- | ||||
| This API is evolving. | ||||
|
|
@@ -489,9 +492,11 @@ def fromJson(cls, j: Dict[str, Any]) -> "StreamingQueryProgress": | |||
| stateOperators=[StateOperatorProgress.fromJson(s) for s in j["stateOperators"]], | ||||
| sources=[SourceProgress.fromJson(s) for s in j["sources"]], | ||||
| sink=SinkProgress.fromJson(j["sink"]), | ||||
| numInputRows=j["numInputRows"], | ||||
| inputRowsPerSecond=j["inputRowsPerSecond"], | ||||
| processedRowsPerSecond=j["processedRowsPerSecond"], | ||||
| numInputRows=j["numInputRows"] if "numInputRows" in j else None, | ||||
| inputRowsPerSecond=j["inputRowsPerSecond"] if "inputRowsPerSecond" in j else None, | ||||
| processedRowsPerSecond=j["processedRowsPerSecond"] | ||||
| if "processedRowsPerSecond" in j | ||||
| else None, | ||||
| observedMetrics={ | ||||
| k: Row(*row_dict.keys())(*row_dict.values()) # Assume no nested rows | ||||
| for k, row_dict in j["observedMetrics"].items() | ||||
|
|
@@ -500,6 +505,19 @@ def fromJson(cls, j: Dict[str, Any]) -> "StreamingQueryProgress": | |||
| else {}, | ||||
| ) | ||||
|
|
||||
| def __getitem__(self, key: str) -> Any: | ||||
| # Before Spark 4.0, StreamingQuery.lastProgress returns a dict, which casts id and runId | ||||
| # to string. But here they are UUID. | ||||
| # To prevent breaking change, also cast them to string when accessed with __getitem__. | ||||
| if key == "id" or key == "runId": | ||||
|
||||
| def sources(self) -> List["SourceProgress"]: |
let me also make these subclass of dict...
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the fixes of __getitem__ and __setitem__ but we do self.update(dict(id=id, runId=runId, ...)) at __init__?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sure let me do that
Uh oh!
There was an error while loading. Please reload this page.