Title: feat: configure DataFusion's built-in `CacheManager` from Java · Issue #74 · apache/datafusion-java · GitHub
Open Graph Title: feat: configure DataFusion's built-in `CacheManager` from Java · Issue #74 · apache/datafusion-java
X Title: feat: configure DataFusion's built-in `CacheManager` from Java · Issue #74 · apache/datafusion-java
Description: Is your feature request related to a problem or challenge? The Rust API to enable any of these is RuntimeEnvBuilder::with_cache_manager(CacheManagerConfig). The Java binding exposes none of it — every SessionContext ends up with the no-o...
Open Graph Description: Is your feature request related to a problem or challenge? The Rust API to enable any of these is RuntimeEnvBuilder::with_cache_manager(CacheManagerConfig). The Java binding exposes none of it — ev...
X Description: Is your feature request related to a problem or challenge? The Rust API to enable any of these is RuntimeEnvBuilder::with_cache_manager(CacheManagerConfig). The Java binding exposes none of it — ev...
Opengraph URL: https://github.com/apache/datafusion-java/issues/74
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: configure DataFusion's built-in `CacheManager` from Java","articleBody":"### Is your feature request related to a problem or challenge?\n\nThe Rust API to enable any of these is `RuntimeEnvBuilder::with_cache_manager(CacheManagerConfig)`. The Java binding exposes none of it — every `SessionContext` ends up with the no-op defaults (metadata-cache enabled but at 0 size, list-files and stats caches disabled). For a parquet workload reading the same footer thousands of times across queries, that means every footer read goes back to the object store. For a long-lived statistics-driven planner, no stats persist across queries.\n\nThere is no Java surface today to plug in or even just turn on the built-in caches.\n\n### Describe the solution you'd like\n\nAdd a `cacheManager(CacheManagerOptions)` setter to `SessionContextBuilder`. The options object mirrors upstream `CacheManagerConfig` 1:1 — three independent toggles, each with the same knobs upstream exposes:\n\n```java\nSessionContext ctx = SessionContext.builder()\n .cacheManager(CacheManagerOptions.builder()\n .fileMetadataCache(64L \u003c\u003c 20) // 64 MiB cap\n .listFilesCache(8L \u003c\u003c 20, Duration.ofMinutes(5)) // 8 MiB cap, 5min TTL\n .fileStatisticsCache(true)\n .build())\n .build();\n```\nSemantics, all matching upstream (datafusion).\n\nThree independent toggles, all matching upstream:\n\n| Field | Java unset → Rust behaviour |\n|--------------------------------|-----------------------------------------------------|\n| `fileMetadataCache(maxBytes)` | leave `metadata_cache_limit` at upstream default |\n| `listFilesCache(maxBytes,ttl)` | leave `list_files_cache = None` (disabled) |\n| `fileStatisticsCache(enabled)` | leave `table_files_statistics_cache = None` |\n\n### Describe alternatives you've considered\n\n**Java SPI for cache implementations** — `org.apache.datafusion.cache.{FileMetadataCache, ListFilesCache, FileStatisticsCache}` interfaces that callers implement in Java, with arbitrary upcalls into Java for every cache `get`/`put`. **Rejected for v1.** A `FileMetadataCache::get` runs once per parquet file in a scan; routing those through JNI upcalls turns a hot path into a slow path. The upstream Rust traits are easy to implement; embedders that want a custom cache (LRU on disk, Foyer-backed, network-replicated) can build it Rust-side and ship a fork until the day the cost-benefit of a Java SPI flips. The `Out of scope` note in `CONTRIB_ISSUES.md` for #13 (\"Pluggable `CacheManager` *implementations* written in Java\") makes this explicit.\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/LantaoJin","@type":"Person","name":"LantaoJin"},"datePublished":"2026-05-20T10:08:39Z","url":"https://github.com/apache/datafusion-java/issues/74"}
| 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:9ff77846-a5e9-23ef-ea7b-1bbbc0e05b8f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FE2:2D066D:2C4496:3CCD5C:6B046A0D |
| html-safe-nonce | 6f0b1d6f39e142bc45805a4397aebb9e94e886804ac63d45951983938248afc7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkUyOjJEMDY2RDoyQzQ0OTY6M0NDRDVDOjZCMDQ2QTBEIiwidmlzaXRvcl9pZCI6IjM0NjI2Mzc1MDIzNzUxNjAzMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ed30cd05a60af9e0e499a30e8277f7372cdae786e24303833448275f6709e305 |
| hovercard-subject-tag | issue:4485348246 |
| 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/74/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c87840af84c72146965a8acf50b6a07d8ad712dd3ab8fba0467640f0f6d5c98d/apache/datafusion-java/issues/74 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c87840af84c72146965a8acf50b6a07d8ad712dd3ab8fba0467640f0f6d5c98d/apache/datafusion-java/issues/74 |
| og:image:alt | Is your feature request related to a problem or challenge? The Rust API to enable any of these is RuntimeEnvBuilder::with_cache_manager(CacheManagerConfig). The Java binding exposes none of it — ev... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LantaoJin |
| 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