Skip to content

Commit

Permalink
address a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon committed Jun 8, 2024
1 parent ab95e64 commit 9bd8aea
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions python/pyspark/sql/streaming/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,17 @@ class StreamingQueryListener(ABC):
"""

def _set_spark_session(
self, spark: "SparkSession" # type: ignore[name-defined] # noqa: F821
self, session: "SparkSession" # type: ignore[name-defined] # noqa: F821
) -> None:
self._sparkSession = spark
if self.spark is not None:
self.spark = session

@property
def spark(self) -> Optional["SparkSession"]: # type: ignore[name-defined] # noqa: F821
if hasattr(self, "_sparkSession"):
return self._sparkSession
else:
return None
return getattr(self, "_sparkSession", None)

@spark.setter
def spark(self, session):
def spark(self, session) -> None:
# For backward compatibility
self._sparkSession = session

Expand Down

0 comments on commit 9bd8aea

Please sign in to comment.