Class SessionContextBuilder
SessionContext. Each setter is optional; unset fields leave the
DataFusion default in place.-
Method Summary
Modifier and TypeMethodDescriptionbatchSize(int batchSize) build()Construct aSessionContextwith the configured options.collectStatistics(boolean collectStatistics) informationSchema(boolean informationSchema) memoryLimit(long maxMemoryBytes, double fraction) Cap the memory pool atmaxMemoryBytes, reservingfractionof it for queries.registerObjectStore(ObjectStoreOptions options) Register anobject_store::ObjectStorebackend on the new context'sRuntimeEnv.Set an arbitrarydatafusion.*config option by string key.setOptions(LinkedHashMap<String, String> entries) setOptions(Map<String, String> entries) Apply every entry ofentriesviasetOption(String, String).targetPartitions(int targetPartitions) tempDirectory(String path) Directory the DiskManager uses for spill files.
-
Method Details
-
batchSize
-
targetPartitions
-
collectStatistics
-
informationSchema
-
memoryLimit
Cap the memory pool atmaxMemoryBytes, reservingfractionof it for queries. -
tempDirectory
Directory the DiskManager uses for spill files. -
setOption
Set an arbitrarydatafusion.*config option by string key. Mirrors DataFusion'sConfigOptions::set(key, value)API — see the DataFusion configuration reference for the full set of keys. Entries set this way are applied after the typed setters on this builder, so an explicitsetOptioncall overrides a typed setter for the same knob.datafusion.runtime.*keys (memory limit, temp directory, cache sizes, etc) are not yet supported by this setter and will throw atbuild(). Use the typedmemoryLimit(long, double)andtempDirectory(String)setters instead. Round-trip support for the runtime subtree is tracked as a follow-up.Unknown keys or unparseable values are not validated here; they surface as a
RuntimeExceptionfrombuild()carrying DataFusion's error message.- Throws:
IllegalArgumentException- ifkeyorvalueisnull.
-
setOptions
Apply every entry ofentriesviasetOption(String, String), inLinkedHashMapinsertion order. Use this overload when you need the strict last-write-wins ordering guarantee for overlapping side-effect keys (e.g.datafusion.optimizer.enable_dynamic_filter_pushdownrewrites the per-operatorenable_*_dynamic_filter_pushdownflags, so a per-operator override must come after the umbrella).- Throws:
IllegalArgumentException- if any key or value inentriesisnull.
-
setOptions
Apply every entry ofentriesviasetOption(String, String). Iterates in whatever order the suppliedMapproduces, which forHashMaporPropertiesis unspecified.This is the right overload for the common case where the caller's keys don't overlap with any upstream setter's side effects. If you do need order — see the
setOptions(LinkedHashMap)overload, which the compiler will resolve to automatically when you pass aLinkedHashMap.- Throws:
IllegalArgumentException- if any key or value inentriesisnull.
-
registerObjectStore
Register anobject_store::ObjectStorebackend on the new context'sRuntimeEnv. BuildObjectStoreOptionsvia the per-backend factories (ObjectStoreOptions.s3(),ObjectStoreOptions.gcs(),ObjectStoreOptions.http(String)). The store is reachable inside the resultingSessionContextby URL — e.g. once an S3 store is registered formy-bucket,ctx.registerParquet("orders", "s3://my-bucket/orders/")will resolve through it.Multiple registrations are applied in the order added; if two registrations resolve to the same URL, the later one wins (matching upstream
RuntimeEnv::register_object_store).If the underlying
object_storecloud-backend Cargo feature is not built into the native library,build()surfaces a clear error rather than silently dropping the registration. The defaultmakebuild enables all three backends (S3 / GCS / HTTP).- Throws:
IllegalArgumentException- ifoptionsisnull.
-
build
Construct aSessionContextwith the configured options.- Throws:
RuntimeException- if the native side fails to construct the context.
-