This is an automated email from the ASF dual-hosted git repository.

srowen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new d708fd7b68b [MINOR][DOCS] Fix Python code sample for 
StreamingQueryListener: Reporting Metrics programmatically using Asynchronous 
APIs
d708fd7b68b is described below

commit d708fd7b68bf0c9964e861cb2c81818d17d7136e
Author: Peter Kaszt <kas...@gmail.com>
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 <kas...@gmail.com>
    Signed-off-by: Sean Owen <sro...@gmail.com>
---
 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 70e763be0d7..774422a9cd9 100644
--- a/docs/structured-streaming-programming-guide.md
+++ b/docs/structured-streaming-programming-guide.md
@@ -3837,10 +3837,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: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to