This is an automated email from the ASF dual-hosted git repository.
srowen pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.5 by this push:
new 845e4f6c5bc [MINOR][DOCS] Fix Python code sample for
StreamingQueryListener: Reporting Metrics programmatically using Asynchronous
APIs
845e4f6c5bc is described below
commit 845e4f6c5bcf3a368ee78757f3a74b390cdce5c0
Author: Peter Kaszt <[email protected]>
AuthorDate: Mon Oct 2 07:48:56 2023 -0500
[MINOR][DOCS] Fix Python code sample for StreamingQueryListener: Reporting
Metrics programmatically using Asynchronous APIs
Fix Python language code sample in the docs for _StreamingQueryListener_:
Reporting Metrics programmatically using Asynchronous APIs section.
### What changes were proposed in this pull request?
The code sample in the [Reporting Metrics programmatically using
Asynchronous
APIs](https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#reporting-metrics-programmatically-using-asynchronous-apis)
section was this:
```
spark = ...
class Listener(StreamingQueryListener):
def onQueryStarted(self, event):
print("Query started: " + queryStarted.id)
def onQueryProgress(self, event):
println("Query terminated: " + queryTerminated.id)
def onQueryTerminated(self, event):
println("Query made progress: " + queryProgress.progress)
spark.streams.addListener(Listener())
```
Which is not a proper Python code, and has QueryProgress and
QueryTerminated prints mixed. Proposed change/fix:
```
spark = ...
class Listener(StreamingQueryListener):
def onQueryStarted(self, event):
print("Query started: " + queryStarted.id)
def onQueryProgress(self, event):
print("Query made progress: " + queryProgress.progress)
def onQueryTerminated(self, event):
print("Query terminated: " + queryTerminated.id)
spark.streams.addListener(Listener())
```
### Why are the changes needed?
To fix docimentation errors.
### Does this PR introduce _any_ user-facing change?
Yes. -> Sample python code snippet is fixed in docs (see above).
### How was this patch tested?
Checked with github's .md preview, and built the docs according to the
readme.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #43190 from kasztp/master.
Authored-by: Peter Kaszt <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
(cherry picked from commit d708fd7b68bf0c9964e861cb2c81818d17d7136e)
Signed-off-by: Sean Owen <[email protected]>
---
docs/structured-streaming-programming-guide.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/structured-streaming-programming-guide.md
b/docs/structured-streaming-programming-guide.md
index 76a22621a0e..3e87c45a349 100644
--- a/docs/structured-streaming-programming-guide.md
+++ b/docs/structured-streaming-programming-guide.md
@@ -3831,10 +3831,10 @@ class Listener(StreamingQueryListener):
print("Query started: " + queryStarted.id)
def onQueryProgress(self, event):
- println("Query terminated: " + queryTerminated.id)
+ print("Query made progress: " + queryProgress.progress)
def onQueryTerminated(self, event):
- println("Query made progress: " + queryProgress.progress)
+ print("Query terminated: " + queryTerminated.id)
spark.streams.addListener(Listener())
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]