Skip to content

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.

const spark = SparkSession.builder()
.remote("sc://localhost:15002")
.transport(myTransport)
.arrowDecoder(myDecoder)
.getOrCreate();
new SparkSessionBuilder(): SparkSessionBuilder;

SparkSessionBuilder

arrowDecoder(decoder): this;

Defined in: spark-session.ts:380

Inject an Arrow IPC decoder. Required for collect() and similar actions.

ParameterType
decoderArrowDecoderFn

this


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.

SparkSession


remote(connectionString): this;

Defined in: spark-session.ts:368

Set the Spark Connect endpoint URL (sc://host:port). Required.

ParameterType
connectionStringstring

this


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.

ParameterType
idstring

this


transport(t): this;

Defined in: spark-session.ts:374

Inject a Transport implementation. Required.

ParameterType
tTransport

this