Package org.apache.spark.sql
Class SparkSession.Builder
Object
org.apache.spark.sql.SparkSession.Builder
- Enclosing class:
- SparkSession
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Stringstatic Stringstatic Stringstatic StringSets a name for the application, which will be shown in the Spark web UI.static Stringclassic()Make the builder create a Classic SparkSession.Sets a config option.Sets a config option.Sets a config option.Sets a config option.Sets a config option.Sets a list of config options based on the givenSparkConf.Sets a config option.connect()Make the builder create a Connect SparkSession.static Stringcreate()Create a newSparkSession.Enables Hive support, including connectivity to a persistent Hive metastore, support for Hive serdes, and Hive user-defined functions.Gets an existingSparkSessionor, if there is no existing one, creates a new one based on the options set in this builder.Sets the Spark master URL to connect to, such as "local" to run locally, "local[4]" to run locally with 4 cores, or "spark://master:7077" to run on a Spark standalone cluster.static StringSets the Spark Connect remote URL.withExtensions(scala.Function1<SparkSessionExtensions, scala.runtime.BoxedUnit> f) Inject extensions into theSparkSession.
- 
Constructor Details- 
Builderpublic Builder()
 
- 
- 
Method Details- 
appNameSets a name for the application, which will be shown in the Spark web UI. If no application name is set, a randomly generated name will be used.- Parameters:
- name- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
classicMake the builder create a Classic SparkSession.- Returns:
- (undocumented)
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- key- (undocumented)
- value- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- key- (undocumented)
- value- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- key- (undocumented)
- value- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- key- (undocumented)
- value- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- map- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a config option. Options set using this method are automatically propagated to bothSparkConfand SparkSession's own configuration.- Parameters:
- map- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
configSets a list of config options based on the givenSparkConf.- Parameters:
- conf- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
connectMake the builder create a Connect SparkSession.- Returns:
- (undocumented)
 
- 
createCreate a newSparkSession.This will always return a newly created session. This method will update the default and/or active session if they are not set. - Returns:
- (undocumented)
- Inheritdoc:
 
- 
enableHiveSupportEnables Hive support, including connectivity to a persistent Hive metastore, support for Hive serdes, and Hive user-defined functions.- Returns:
- (undocumented)
- Inheritdoc:
 
- 
getOrCreateGets an existingSparkSessionor, if there is no existing one, creates a new one based on the options set in this builder.This method first checks whether there is a valid thread-local SparkSession, and if yes, return that one. It then checks whether there is a valid global default SparkSession, and if yes, return that one. If no valid global default SparkSession exists, the method creates a new SparkSession and assigns the newly created SparkSession as the global default. In case an existing SparkSession is returned, the non-static config options specified in this builder will be applied to the existing SparkSession. - Returns:
- (undocumented)
- Inheritdoc:
 
- 
masterSets the Spark master URL to connect to, such as "local" to run locally, "local[4]" to run locally with 4 cores, or "spark://master:7077" to run on a Spark standalone cluster.- Parameters:
- master- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
remoteSets the Spark Connect remote URL.- Parameters:
- connectionString- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
withExtensionspublic SparkSession.Builder withExtensions(scala.Function1<SparkSessionExtensions, scala.runtime.BoxedUnit> f) Inject extensions into theSparkSession. This allows a user to add Analyzer rules, Optimizer rules, Planning Strategies or a customized parser.- Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
- Inheritdoc:
 
- 
MASTER_KEY
- 
APP_NAME_KEY
- 
CATALOG_IMPL_KEY
- 
CONNECT_REMOTE_KEY
- 
API_MODE_KEY
- 
API_MODE_CLASSIC
- 
API_MODE_CONNECT
 
-