Package dev.vortex.spark
Class VortexSparkSession
java.lang.Object
dev.vortex.spark.VortexSparkSession
JVM-wide holder for one or more Vortex
Sessions used by Spark readers and writers. The Rust side multiplexes
every session onto one shared current-thread runtime, so sharing a single Java handle per JVM amortises session
construction across every Spark task.
Three levels of customisation:
- Default: call
get()— returns a lazily-initialised singleton that lives for the life of the JVM. No configuration required. - Driver-side override: call
setDefault(Session)with a custom session before any Spark action. Effective on the driver JVM only. - Executor-friendly override: pass option
vortex.session.providerwith the fully-qualified name of aVortexSessionProviderimplementation (no-arg constructor). Spark ships the class name to every executor, which instantiates the provider once per JVM and caches the returned session. Use this when you need the same custom session on the driver and on executors.
Native resources are released by VortexCleaner when the JVM shuts down; sessions held here are strongly
referenced for the JVM's lifetime.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringOptions key used to select aVortexSessionProviderby class name. -
Method Summary
Modifier and TypeMethodDescriptionstatic dev.vortex.api.Sessionget()Returns the default JVM-wide session, creating it on first use.static dev.vortex.api.SessionResolve the session to use for a given set of Spark format options.static voidsetDefault(dev.vortex.api.Session session) Replace the default session.
-
Field Details
-
PROVIDER_OPTION
Options key used to select aVortexSessionProviderby class name.- See Also:
-
-
Method Details
-
get
public static dev.vortex.api.Session get()Returns the default JVM-wide session, creating it on first use. -
get
Resolve the session to use for a given set of Spark format options. Honours the "vortex.session.provider" key; falls back toget()otherwise. -
setDefault
public static void setDefault(dev.vortex.api.Session session) Replace the default session. Intended for driver-side customisation before any Spark action runs. Does not propagate to executors — useVortexSessionProviderfor that.
-