Class VortexSparkSession

java.lang.Object
dev.vortex.spark.VortexSparkSession

public final class VortexSparkSession extends Object
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:

  1. Default: call get() — returns a lazily-initialised singleton that lives for the life of the JVM. No configuration required.
  2. Driver-side override: call setDefault(Session) with a custom session before any Spark action. Effective on the driver JVM only.
  3. Executor-friendly override: pass option vortex.session.provider with the fully-qualified name of a VortexSessionProvider implementation (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 Details

  • Method Details

    • get

      public static dev.vortex.api.Session get()
      Returns the default JVM-wide session, creating it on first use.
    • get

      public static dev.vortex.api.Session get(Map<String,String> options)
      Resolve the session to use for a given set of Spark format options. Honours the "vortex.session.provider" key; falls back to get() 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 — use VortexSessionProvider for that.