class SparkSession extends sql.SparkSession with Logging
The entry point to programming Spark with the Dataset and DataFrame API.
In environments that this has been created upfront (e.g. REPL, notebooks), use the builder to get an existing session:
SparkSession.builder().getOrCreate()
The builder can also be used to create a new session:
SparkSession.builder
.remote("sc://localhost:15001/myapp")
.getOrCreate()
- Alphabetic
- By Inheritance
- SparkSession
- Logging
- SparkSession
- Closeable
- AutoCloseable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- implicit class LogStringContext extends AnyRef
- Definition Classes
- Logging
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addArtifact(source: String, target: String): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- Annotations
- @Experimental()
- def addArtifact(bytes: Array[Byte], target: String): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- Annotations
- @Experimental()
- def addArtifact(uri: URI): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- Annotations
- @Experimental()
- def addArtifact(path: String): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- Annotations
- @Experimental()
- def addArtifacts(uri: URI*): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- Annotations
- @Experimental() @varargs()
- def addTag(tag: String): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def baseRelationToDataFrame(baseRelation: BaseRelation): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- lazy val catalog: Catalog
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def clearTags(): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def close(): Unit
Close the SparkSession.
Close the SparkSession.
Release the current session and close the GRPC connection to the server. The API will not error if any of these operations fail. Closing a closed session is a no-op.
Close the allocator. Fail if there are still open SparkResults.
- Definition Classes
- SparkSession → Closeable → AutoCloseable
- Since
3.4.0
- val conf: RuntimeConfig
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(rdd: JavaRDD[_], beanClass: Class[_]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(rdd: RDD[_], beanClass: Class[_]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(rowRDD: JavaRDD[Row], schema: StructType): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(rowRDD: RDD[Row], schema: StructType): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame[A <: Product](rdd: RDD[A])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(data: List[_], beanClass: Class[_]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame(rows: List[Row], schema: StructType): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataFrame[A <: Product](data: Seq[A])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataset[T](data: RDD[T])(implicit arg0: Encoder[T]): Dataset[T]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataset[T](data: List[T])(implicit arg0: Encoder[T]): Dataset[T]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def createDataset[T](data: Seq[T])(implicit arg0: Encoder[T]): Dataset[T]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- val emptyDataFrame: DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def emptyDataset[T](implicit arg0: Encoder[T]): Dataset[T]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def execute(command: Command): Seq[ExecutePlanResponse]
- Annotations
- @Since("4.0.0") @DeveloperApi()
- def executeCommand(runner: String, command: String, options: Map[String, String]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def experimental: ExperimentalMethods
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getTags(): Set[String]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def interruptAll(): Seq[String]
Interrupt all operations of this session currently running on the connected server.
Interrupt all operations of this session currently running on the connected server.
- returns
sequence of operationIds of interrupted operations. Note: there is still a possibility of operation finishing just as it is interrupted.
- Definition Classes
- SparkSession → SparkSession
- Since
3.5.0
- def interruptOperation(operationId: String): Seq[String]
Interrupt an operation of this session with the given operationId.
Interrupt an operation of this session with the given operationId.
- returns
sequence of operationIds of interrupted operations. Note: there is still a possibility of operation finishing just as it is interrupted.
- Definition Classes
- SparkSession → SparkSession
- Since
3.5.0
- def interruptTag(tag: String): Seq[String]
Interrupt all operations of this session with the given operation tag.
Interrupt all operations of this session with the given operation tag.
- returns
sequence of operationIds of interrupted operations. Note: there is still a possibility of operation finishing just as it is interrupted.
- Definition Classes
- SparkSession → SparkSession
- Since
3.5.0
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def listenerManager: ExecutionListenerManager
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newDataFrame(cols: Seq[Column])(f: (Builder) => Unit): DataFrame
Create a DataFrame including the proto plan built by the given function.
Create a DataFrame including the proto plan built by the given function.
Use this method when columns are used to create a new DataFrame. When there are columns referring to other Dataset or DataFrame, the plan will be wrapped with a
WithRelation
.with_relations [id 10] root: plan [id 9] using columns referring to other Dataset or DataFrame, holding plan ids reference: refs#1: [id 8] plan for the reference 1 refs#2: [id 5] plan for the reference 2
- cols
The columns to be used in the DataFrame.
- f
The function to build the proto plan.
- returns
The DataFrame created from the proto plan.
- Annotations
- @Since("4.0.0") @DeveloperApi()
- def newDataFrame(f: (Builder) => Unit): DataFrame
Create a DataFrame including the proto plan built by the given function.
Create a DataFrame including the proto plan built by the given function.
- f
The function to build the proto plan.
- returns
The DataFrame created from the proto plan.
- Annotations
- @Since("4.0.0") @DeveloperApi()
- def newDataset[T](encoder: AgnosticEncoder[T], cols: Seq[Column])(f: (Builder) => Unit): Dataset[T]
Create a Dataset including the proto plan built by the given function.
Create a Dataset including the proto plan built by the given function.
Use this method when columns are used to create a new Dataset. When there are columns referring to other Dataset or DataFrame, the plan will be wrapped with a
WithRelation
.with_relations [id 10] root: plan [id 9] using columns referring to other Dataset or DataFrame, holding plan ids reference: refs#1: [id 8] plan for the reference 1 refs#2: [id 5] plan for the reference 2
- encoder
The encoder for the Dataset.
- cols
The columns to be used in the DataFrame.
- f
The function to build the proto plan.
- returns
The Dataset created from the proto plan.
- Annotations
- @Since("4.0.0") @DeveloperApi()
- def newDataset[T](encoder: AgnosticEncoder[T])(f: (Builder) => Unit): Dataset[T]
Create a Dataset including the proto plan built by the given function.
Create a Dataset including the proto plan built by the given function.
- encoder
The encoder for the Dataset.
- f
The function to build the proto plan.
- returns
The Dataset created from the proto plan.
- Annotations
- @Since("4.0.0") @DeveloperApi()
- def newSession(): SparkSession
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def range(start: Long, end: Long, step: Long, numPartitions: Int): Dataset[Long]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def range(start: Long, end: Long, step: Long): Dataset[Long]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def range(start: Long, end: Long): Dataset[Long]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def range(end: Long): Dataset[Long]
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def read: DataFrameReader
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def readStream: DataStreamReader
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def registerClassFinder(finder: ClassFinder): Unit
Register a ClassFinder for dynamically generated classes.
Register a ClassFinder for dynamically generated classes.
- Annotations
- @Experimental()
- Since
3.5.0
- def removeTag(tag: String): Unit
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sessionState: SessionState
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sharedState: SharedState
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sparkContext: SparkContext
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sql(query: String): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sql(sqlText: String, args: Map[String, Any]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sql(sqlText: String, args: Map[String, Any]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def sql(sqlText: String, args: Array[_]): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- val sqlContext: SQLContext
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def stop(): Unit
- Definition Classes
- SparkSession
- lazy val streams: StreamingQueryManager
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def table(tableName: String): DataFrame
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- def time[T](f: => T): T
- Definition Classes
- SparkSession
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tvf: TableValuedFunction
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- lazy val udf: UDFRegistration
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
- lazy val version: String
- Definition Classes
- SparkSession → SparkSession
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withActive[T](block: => T): T
- Definition Classes
- SparkSession
- Annotations
- @DeveloperApi()
- def withLogContext(context: Map[String, String])(body: => Unit): Unit
- Attributes
- protected
- Definition Classes
- Logging
- object implicits extends SQLImplicits
<invalid inheritdoc annotation>
<invalid inheritdoc annotation>
- Definition Classes
- SparkSession → SparkSession
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)