File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
python/pyspark/sql/streaming Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 26
26
27
27
if TYPE_CHECKING :
28
28
from py4j .java_gateway import JavaObject
29
+ from pyspark .sql import SparkSession
29
30
30
31
31
32
class StreamingQueryListener (ABC ):
@@ -64,19 +65,17 @@ class StreamingQueryListener(ABC):
64
65
"""
65
66
66
67
def _set_spark_session (
67
- self , spark : "SparkSession" # type: ignore[name-defined] # noqa: F821
68
+ self , session : "SparkSession" # type: ignore[name-defined] # noqa: F821
68
69
) -> None :
69
- self ._sparkSession = spark
70
+ if self .spark is not None :
71
+ self .spark = session
70
72
71
73
@property
72
74
def spark (self ) -> Optional ["SparkSession" ]: # type: ignore[name-defined] # noqa: F821
73
- if hasattr (self , "_sparkSession" ):
74
- return self ._sparkSession
75
- else :
76
- return None
75
+ return getattr (self , "_sparkSession" , None )
77
76
78
77
@spark .setter
79
- def spark (self , session ) :
78
+ def spark (self , session : "SparkSession" ) -> None :
80
79
# For backward compatibility
81
80
self ._sparkSession = session
82
81
You can’t perform that action at this time.
0 commit comments