SparkSessionBuilder
Defined in: spark-session.ts:364
Fluent builder for SparkSession. Returned by SparkSession.builder()
in @spark-connect-js/core; runtime adapters (e.g. @spark-connect-js/node)
usually subclass it to add their own transport defaults.
Example
Section titled “Example”const spark = SparkSession.builder() .remote("sc://localhost:15002") .transport(myTransport) .arrowDecoder(myDecoder) .getOrCreate();Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SparkSessionBuilder(): SparkSessionBuilder;Returns
Section titled “Returns”SparkSessionBuilder
Methods
Section titled “Methods”arrowDecoder()
Section titled “arrowDecoder()”arrowDecoder(decoder): this;Defined in: spark-session.ts:380
Inject an Arrow IPC decoder. Required for collect() and similar actions.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
decoder | ArrowDecoderFn |
Returns
Section titled “Returns”this
getOrCreate()
Section titled “getOrCreate()”getOrCreate(): SparkSession;Defined in: spark-session.ts:401
Construct the session. In Spark Connect, “getOrCreate” is a server-side concept: the server may return an existing session if the session ID matches. On the client we just instantiate the handle.
Returns
Section titled “Returns”remote()
Section titled “remote()”remote(connectionString): this;Defined in: spark-session.ts:368
Set the Spark Connect endpoint URL (sc://host:port). Required.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
connectionString | string |
Returns
Section titled “Returns”this
sessionId()
Section titled “sessionId()”sessionId(id): this;Defined in: spark-session.ts:390
Reuse an existing server-side session by ID. Must be a canonical UUID
string in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. If unset, a
fresh UUID is generated on the client.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id | string |
Returns
Section titled “Returns”this
transport()
Section titled “transport()”transport(t): this;Defined in: spark-session.ts:374
Inject a Transport implementation. Required.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
t | Transport |
Returns
Section titled “Returns”this