public static class SparkSession.Builder extends Object implements Logging
SparkSession
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SparkSession.Builder |
appName(String name)
Sets a name for the application, which will be shown in the Spark web UI.
|
SparkSession.Builder |
config(SparkConf conf)
Sets a list of config options based on the given
SparkConf . |
SparkSession.Builder |
config(String key,
boolean value)
Sets a config option.
|
SparkSession.Builder |
config(String key,
double value)
Sets a config option.
|
SparkSession.Builder |
config(String key,
long value)
Sets a config option.
|
SparkSession.Builder |
config(String key,
String value)
Sets a config option.
|
SparkSession.Builder |
enableHiveSupport()
Enables Hive support, including connectivity to a persistent Hive metastore, support for
Hive serdes, and Hive user-defined functions.
|
SparkSession |
getOrCreate()
Gets an existing
SparkSession or, if there is no existing one, creates a new
one based on the options set in this builder. |
SparkSession.Builder |
master(String master)
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.
|
SparkSession.Builder |
withExtensions(scala.Function1<SparkSessionExtensions,scala.runtime.BoxedUnit> f)
Inject extensions into the
SparkSession . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeLogging, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public SparkSession.Builder appName(String name)
name
- (undocumented)public SparkSession.Builder config(String key, String value)
SparkConf
and SparkSession's own configuration.
key
- (undocumented)value
- (undocumented)public SparkSession.Builder config(String key, long value)
SparkConf
and SparkSession's own configuration.
key
- (undocumented)value
- (undocumented)public SparkSession.Builder config(String key, double value)
SparkConf
and SparkSession's own configuration.
key
- (undocumented)value
- (undocumented)public SparkSession.Builder config(String key, boolean value)
SparkConf
and SparkSession's own configuration.
key
- (undocumented)value
- (undocumented)public SparkSession.Builder config(SparkConf conf)
SparkConf
.
conf
- (undocumented)public SparkSession.Builder master(String master)
master
- (undocumented)public SparkSession.Builder enableHiveSupport()
public SparkSession.Builder withExtensions(scala.Function1<SparkSessionExtensions,scala.runtime.BoxedUnit> f)
SparkSession
. This allows a user to add Analyzer rules,
Optimizer rules, Planning Strategies or a customized parser.
f
- (undocumented)public SparkSession getOrCreate()
SparkSession
or, 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 config options specified in this builder will be applied to the existing SparkSession.