SessionContext.registerParquet(name, "s3://bucket/...") (and the read/register counterparts for CSV / NDJSON / Arrow / Avro) accept arbitrary path strings, but until this PR there was no Java surface to attach an object_store::ObjectStore to a URL scheme + bucket. As a result, s3://, gs://, and remote https:// paths fail with "No suitable object store found for ..." unless the embedder shells out to process-level environment variables — and even then, multi-tenant JVMs cannot give two contexts different credentials in the same process.
DataFusion's Rust RuntimeEnv::register_object_store(url, store) already solves this end of the problem; the gap was purely in the Java surface above the JNI line. This PR closes it with a typed, per-context registration API:
Java API: new org.apache.datafusion.ObjectStoreOptions
Native: new native/src/object_store.rs
Cargo features: object-store-{aws,gcp,http}, with default = ["object-store-aws", "object-store-gcp", "object-store-http"]
Build wiring: proto/object_store_options.proto
Are these changes tested?
23 new tests across ObjectStoreOptionsTest and SessionContextObjectStoreTest
Are there any user-facing changes?
Yes, additive only, no breaking changes:
New public class org.apache.datafusion.ObjectStoreOptions (sealed) with three concrete subtypes S3 / Gcs / Http and per-backend builders. Static factories: ObjectStoreOptions.s3(), .gcs(), .http(listingUrl).
New public method SessionContextBuilder.registerObjectStore(ObjectStoreOptions).
Generated protobuf classes ObjectStoreRegistration, S3Options, GcsOptions, HttpOptions under org.apache.datafusion.protobuf (consistent with existing options bundles).
New repeated ObjectStoreRegistration object_stores = 8 field on SessionOptions (proto-3 forward compatible — older builds simply ignore it).
Existing APIs are unchanged. The make build picks up object-store-{aws,gcp,http} Cargo features by default; downstream Rust builds that strip a feature trip a clear runtime error if a caller registers the missing backend.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
SessionContext.registerParquet(name, "s3://bucket/...") (and the read/register counterparts for CSV / NDJSON / Arrow / Avro) accept arbitrary path strings, but until this PR there was no Java surface to attach an object_store::ObjectStore to a URL scheme + bucket. As a result, s3://, gs://, and remote https:// paths fail with "No suitable object store found for ..." unless the embedder shells out to process-level environment variables — and even then, multi-tenant JVMs cannot give two contexts different credentials in the same process.
DataFusion's Rust RuntimeEnv::register_object_store(url, store) already solves this end of the problem; the gap was purely in the Java surface above the JNI line. This PR closes it with a typed, per-context registration API:
What changes are included in this PR?
Are these changes tested?
23 new tests across ObjectStoreOptionsTest and SessionContextObjectStoreTest
Are there any user-facing changes?
Yes, additive only, no breaking changes:
Existing APIs are unchanged. The make build picks up object-store-{aws,gcp,http} Cargo features by default; downstream Rust builds that strip a feature trip a clear runtime error if a caller registers the missing backend.