nxcals.api.extraction.data.builders.SparkSession.getActiveSession
- classmethod SparkSession.getActiveSession() Optional[SparkSession]
Returns the active
SparkSession
for the current thread, returned by the builderNew in version 3.0.0.
- Returns:
Spark session if an active session exists for the current thread
- Return type:
Examples
>>> s = SparkSession.getActiveSession() >>> l = [('Alice', 1)] >>> rdd = s.sparkContext.parallelize(l) >>> df = s.createDataFrame(rdd, ['name', 'age']) >>> df.select("age").collect() [Row(age=1)]