Title: Build and execute Java-constructed protobuf plans via SessionContext · Issue #8 · apache/datafusion-java · GitHub
Open Graph Title: Build and execute Java-constructed protobuf plans via SessionContext · Issue #8 · apache/datafusion-java
X Title: Build and execute Java-constructed protobuf plans via SessionContext · Issue #8 · apache/datafusion-java
Description: Follow-up to #4. #4 generates Java classes for the datafusion-proto schema. This issue is the end-to-end wiring that makes those classes useful — Java code constructs a LogicalPlanNode, hands it to SessionContext, and gets back a DataFra...
Open Graph Description: Follow-up to #4. #4 generates Java classes for the datafusion-proto schema. This issue is the end-to-end wiring that makes those classes useful — Java code constructs a LogicalPlanNode, hands it to...
X Description: Follow-up to #4. #4 generates Java classes for the datafusion-proto schema. This issue is the end-to-end wiring that makes those classes useful — Java code constructs a LogicalPlanNode, hands it to...
Opengraph URL: https://github.com/apache/datafusion-java/issues/8
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Build and execute Java-constructed protobuf plans via SessionContext","articleBody":"Follow-up to #4.\n\n#4 generates Java classes for the `datafusion-proto` schema. This issue is the end-to-end wiring that makes those classes useful — Java code constructs a `LogicalPlanNode`, hands it to `SessionContext`, and gets back a `DataFrame` that streams Arrow batches the same way `ctx.sql(...)` does today.\n\n## Sketch\n\nThree pieces sit between Java-built protobuf and execution:\n\n1. **Java surface.** A new method on `SessionContext`:\n ```java\n public DataFrame fromProto(byte[] planBytes);\n ```\n No other Java work is needed — the protobuf builders generated by #4 are the public construction API.\n\n2. **JNI bridge.** A single new native method that takes the byte array and returns a `DataFrame` pointer, modeled on the existing `sql()` JNI shim. Arrow FFI stays on the result path; the plan crosses JNI as a primitive `byte[]`.\n\n3. **Rust deserialization + execution.** Add `datafusion-proto = \\\"53\\\"` to `native/Cargo.toml`, then in the JNI implementation:\n ```rust\n let node = datafusion_proto::protobuf::LogicalPlanNode::decode(&bytes[..])?;\n let plan = node.try_into_logical_plan(&ctx.state(), &DefaultLogicalExtensionCodec {})?;\n let df = runtime.block_on(ctx.execute_logical_plan(plan))?;\n ```\n Wrap the resulting `DataFrame` the same way `sql()` does and return its pointer.\n\n## Open design questions for this issue\n\n- **Logical vs. physical plan first.** Recommend logical so DataFusion's own optimizer runs; physical is a follow-up.\n- **Schema discovery.** A JVM caller building a `TableScanNode` needs the schema of registered tables. Likely a new JNI shim like `SessionContext.tableSchema(name) -> org.apache.arrow.vector.types.pojo.Schema`. Without this, the API is not usable for anything but trivial plans.\n- **Extension codec.** `DefaultLogicalExtensionCodec` is fine for now; a real codec arrives with Java-defined UDFs (the fourth roadmap item).\n- **Round-trip tests.** Build a plan in Java, execute it, and compare results against the same query run via `ctx.sql(...)` over the TPC-H integration data.\n\n## Out of scope here\n\n- Java-defined UDFs and their custom extension codec.\n- Physical plan submission.\n- Any builder helpers / fluent API on top of the raw protobuf builders.","author":{"url":"https://github.com/andygrove","@type":"Person","name":"andygrove"},"datePublished":"2026-05-13T01:10:55Z","url":"https://github.com/apache/datafusion-java/issues/8"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:745dfd42-31cf-facc-60b7-de6262f4b70b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F78:17F930:2CD985:3DF193:6B046A07 |
| html-safe-nonce | e19d0ef3a0f090e6a38ac6559ecf7b2491e56c6ac7b779c35ce9327ed4715835 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Rjc4OjE3RjkzMDoyQ0Q5ODU6M0RGMTkzOjZCMDQ2QTA3IiwidmlzaXRvcl9pZCI6IjE4OTc1NzkwMjc3NjI1MzkwMTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f86d2ce0b2f9bed0bfe864cc9d549c4fc667ccab57f05821a1da403f371ddeba |
| hovercard-subject-tag | issue:4433801892 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/datafusion-java/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b033e4538af6045b742637b1869f4b8c267e9d3e6f5073cd6d59692e343b9ae9/apache/datafusion-java/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b033e4538af6045b742637b1869f4b8c267e9d3e6f5073cd6d59692e343b9ae9/apache/datafusion-java/issues/8 |
| og:image:alt | Follow-up to #4. #4 generates Java classes for the datafusion-proto schema. This issue is the end-to-end wiring that makes those classes useful — Java code constructs a LogicalPlanNode, hands it to... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andygrove |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/datafusion-java git https://github.com/apache/datafusion-java.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 1237105117 |
| octolytics-dimension-repository_nwo | apache/datafusion-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1237105117 |
| octolytics-dimension-repository_network_root_nwo | apache/datafusion-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width