关注 spark技术分享,
撸spark源码 玩spark最佳实践

Builder — Building SparkSession using Fluent API

Builder — Building SparkSession using Fluent API

Builder is the fluent API to create a SparkSession.

Table 1. Builder API
Method Description

appName

config

enableHiveSupport

Enables Hive support

getOrCreate

Gets the current SparkSession or creates a new one.

master

withExtensions

Access to the SparkSessionExtensions

Builder is available using the builder object method of a SparkSession.

Note
You can have multiple SparkSessions in a single Spark application for different data catalogs (through relational entities).
Table 2. Builder’s Internal Properties (e.g. Registries, Counters and Flags)
Name Description

extensions

SparkSessionExtensions

Used when…​FIXME

options

Used when…​FIXME

Getting Or Creating SparkSession Instance — getOrCreate Method

getOrCreate…​FIXME

Enabling Hive Support — enableHiveSupport Method

enableHiveSupport enables Hive support, i.e. running structured queries on Hive tables (and a persistent Hive metastore, support for Hive serdes and Hive user-defined functions).

Note

You do not need any existing Hive installation to use Spark’s Hive support. SparkSession context will automatically create metastore_db in the current directory of a Spark application and a directory configured by spark.sql.warehouse.dir.

Refer to SharedState.

Internally, enableHiveSupport makes sure that the Hive classes are on CLASSPATH, i.e. Spark SQL’s org.apache.hadoop.hive.conf.HiveConf, and sets spark.sql.catalogImplementation internal configuration property to hive.

withExtensions Method

withExtensions simply executes the input f function with the SparkSessionExtensions.

appName Method

appName…​FIXME

config Method

config…​FIXME

master Method

master…​FIXME

赞(0) 打赏
未经允许不得转载:spark技术分享 » Builder — Building SparkSession using Fluent API
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏