Skip to content

Transport

Defined in: spark-session.ts:36

The network seam between SparkSession and a Spark Connect server. Runtime adapters (e.g. @spark-connect-js/node) implement this interface to provide actual gRPC I/O, while @spark-connect-js/core stays platform-agnostic.

Most methods are optional: a minimal in-memory Transport for testing only needs executePlan. A full runtime adapter implements them all.

optional analyzePlan(sessionId, request): Promise<Record<string, unknown>>;

Defined in: spark-session.ts:79

Send an AnalyzePlan request (schema, explain, etc.) and return the response.

Parameter Type
sessionId string
request Record<string, unknown>

Promise<Record<string, unknown>>


optional close(): void;

Defined in: spark-session.ts:100

Close the underlying connection. Called from SparkSession.stop().

void


optional config(sessionId, operation): Promise<Record<string, unknown>>;

Defined in: spark-session.ts:85

Get/set/unset runtime configuration via the Config RPC.

Parameter Type
sessionId string
operation Record<string, unknown>

Promise<Record<string, unknown>>


optional executeCommand(
sessionId,
command,
options?): Promise<void>;

Defined in: spark-session.ts:45

Execute a command (write, createView, etc.) that returns no Arrow data.

Parameter Type
sessionId string
command Record<string, unknown>
options? ExecuteOptions

Promise<void>


optional executeCommandResponses(
sessionId,
command,
options?): Promise<Record<string, unknown>[]>;

Defined in: spark-session.ts:61

Execute a command and collect any non-Arrow result payloads from the ExecutePlanResponse stream. Used by streaming commands (e.g. WriteStreamOperationStart, StreamingQueryCommand) where the server returns a structured result.

Each entry in the returned array is a JSON-like shape carrying a type discriminator (e.g. "writeStreamOperationStartResult", "streamingQueryCommandResult") plus the decoded payload fields.

Parameter Type
sessionId string
command Record<string, unknown>
options? ExecuteOptions

Promise<Record<string, unknown>[]>


optional executeCommandStream(
sessionId,
command,
options?): AsyncIterable<Record<string, unknown>>;

Defined in: spark-session.ts:72

Execute a command and yield decoded result frames as the server pushes them. For long-running subscriptions (e.g. the listener bus) where executeCommandResponses’ collect-and-return would never resolve.

Parameter Type
sessionId string
command Record<string, unknown>
options? ExecuteOptions

AsyncIterable<Record<string, unknown>>


executePlan(
sessionId,
plan,
options?): AsyncIterable<Uint8Array<ArrayBufferLike>>;

Defined in: spark-session.ts:38

Execute a plan and stream raw Arrow IPC buffers back to the client.

Parameter Type
sessionId string
plan LogicalPlan
options? ExecuteOptions

AsyncIterable<Uint8Array<ArrayBufferLike>>


optional interrupt(sessionId, request): Promise<string[]>;

Defined in: spark-session.ts:94

Cancel running operations. Returns the operation IDs the server reports as interrupted. The request shape is one of: { type: "all" } { type: "tag", tag: string } { type: "operationId", operationId: string }

Parameter Type
sessionId string
request Record<string, unknown>

Promise<string[]>


optional releaseSession(sessionId): Promise<void>;

Defined in: spark-session.ts:97

Release server-side session state. Called from SparkSession.stop().

Parameter Type
sessionId string

Promise<void>