andygrove opened a new pull request, #28:
URL: https://github.com/apache/datafusion-java/pull/28
## Which issue does this PR close?
- Closes #5.
## Rationale for this change
Previously `new SessionContext()` was the only way to construct a context,
leaving callers with DataFusion's defaults for batch size, partitioning,
statistics, information_schema, memory limits, and disk-spill location. This PR
adds a typed builder so callers can configure those knobs at construction time:
```java
SessionContext ctx = SessionContext.builder()
.batchSize(8192)
.targetPartitions(4)
.collectStatistics(true)
.informationSchema(true)
.memoryLimit(1L << 30, 0.8)
.tempDirectory(spillDir)
.build();
```
The existing zero-arg constructor is untouched, so current callers continue
to work unchanged.
## What changes are included in this PR?
- New `SessionContextBuilder` Java class with typed setters and input
validation (positive sizes, fraction in (0, 1]).
- New static `SessionContext.builder()` factory.
- New project-local `proto/session_options.proto` describing the wire format.
- Maven `protobuf-maven-plugin` split into two named executions so the local
proto compiles alongside the upstream-downloaded ones.
- Rust `prost-build` wired up via a new `native/build.rs` to generate
matching Rust types.
- New JNI function `createSessionContextWithOptions` that decodes the proto,
applies the knobs to `SessionConfig` + `RuntimeEnvBuilder`, and constructs the
context via `SessionContext::new_with_config_rt`.
Object stores, default catalog/schema, and per-query overrides are
intentionally out of scope for this PR.
## Are these changes tested?
Yes. `SessionContextBuilderTest` adds:
- A proto round-trip test that verifies every setter sets the right presence
bit and value.
- A test that unset fields remain absent in the proto.
- `information_schema` on → meta SQL succeeds; off → meta SQL throws. This
is the strongest end-to-end check that an option actually crosses JNI and
changes runtime behavior.
- An all-knobs happy-path test using `@TempDir` for the spill directory and
running `SELECT 1` end-to-end.
Existing `SessionContextTest` continues to pass, confirming the zero-arg
path is unchanged.
## Are there any user-facing changes?
A new public API: `SessionContext.builder()` and the `SessionContextBuilder`
class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]