Skip to content

[SPARK-48560][SS][PYTHON] Make StreamingQueryListener.spark settable - #46909

Closed
HyukjinKwon wants to merge 4 commits into
apache:masterfrom
HyukjinKwon:compat-spark-prop
Closed

HyukjinKwon wants to merge 4 commits into
apache:masterfrom
HyukjinKwon:compat-spark-prop

Conversation

@HyukjinKwon

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR proposes to make StreamingQueryListener.spark settable

Why are the changes needed?

from pyspark.sql.streaming.listener import StreamingQueryListener

class MyListener(StreamingQueryListener):
  def __init__(self, spark):
    self.spark = spark

  def onQueryStarted(self, event):
    pass

  def onQueryProgress(self, event):
    pass

  def onQueryTerminated(self, event):
    pass

MyListener(spark)

is broken from 3.5.0 after SPARK-42941.

Does this PR introduce any user-facing change?

Yes, end users who implement StreamingQueryListener can add spark attribute in their implementation.

How was this patch tested?

Manually tested, and added a unittest.

Was this patch authored or co-authored using generative AI tooling?

No.

@WweiL

WweiL commented Jun 7, 2024

Copy link
Copy Markdown
Contributor

Thanks for the fix!

@WweiL WweiL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending fixing lint

Comment thread python/pyspark/sql/streaming/listener.py
@HyukjinKwon
HyukjinKwon marked this pull request as draft June 9, 2024 02:16
@HyukjinKwon

Copy link
Copy Markdown
Member Author

Will fix up the test

@HyukjinKwon
HyukjinKwon marked this pull request as ready for review June 9, 2024 15:14
@HyukjinKwon

Copy link
Copy Markdown
Member Author

Merged to master.

@rangadi

rangadi commented Jun 11, 2024

Copy link
Copy Markdown

This is awesome. Thanks @HyukjinKwon .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants