Skip to content

Expose metadata reading and writing in vortex-jni#8963

Open
robert3005 wants to merge 5 commits into
developfrom
rk/jnimetadata
Open

Expose metadata reading and writing in vortex-jni#8963
robert3005 wants to merge 5 commits into
developfrom
rk/jnimetadata

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

Expose metadata reading and writing through jni bindings.

Change the VortexWrite into a builder to make it more convenient to add metadata

Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005 robert3005 added the changelog/feature A new feature label Jul 24, 2026
Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 requested review from a10y and mprammer July 24, 2026 22:35
Comment thread vortex-jni/src/file.rs Outdated
Co-authored-by: Martin Prammer <martin@spiraldb.com>
Signed-off-by: Robert Kruszewski <github@robertk.io>
@codspeed-hq

codspeed-hq Bot commented Jul 25, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 19.59%

⚡ 2 improved benchmarks
✅ 1847 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation decode_varbin[(1000, 8)] 34.1 µs 26.7 µs +27.38%
Simulation fsl_large 99.2 µs 88.4 µs +12.28%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/jnimetadata (1cd7164) with develop (a12c310)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

claude added 2 commits July 26, 2026 16:19
Follow-ups from review of the metadata JNI bindings:

- `VortexWriter.Builder.build()` declared `throws IOException`, but every real
  failure arrived as the `RuntimeException` thrown across the JNI boundary, so a
  rejected metadata set escaped uncaught by `catch (IOException)`. Wrap native
  failures the way `writeBatch` and `finish` already do. This also routes the
  Spark writer's failures into its existing `IOException` handler, which logs the
  target path.

- Cover `VortexWriteOptions::validate_metadata` in Rust: the empty-key and
  segment-count branches had no test in either language, and only the
  oversized-key branch was reachable from the Java suite.

- Read metadata through the session footer cache. `readMetadata` opened the file
  with a bare `open_options()`, so reading metadata and then scanning the same
  file paid two footer reads. Factor the cached open out of `multi::open_file`
  into `multi::open_cached` and use it from both. Sources without a URI (the
  `NativeReadable` bridge) skip the cache, since they have no stable identity.

- Release the per-entry local references in `extract_metadata`, matching
  `metadata_to_java` directly below it.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wt7vVoiJrjxHyDvy4XDjsW
`NativeReadable.name()` is already required to be stable and unique, and is
what the scan path keys Java readables by, so a metadata read has an identity
to cache under too. Pass it down and drop the "no key, no caching" path from
`multi::open_cached`: every caller now supplies a fallback key, used when the
source itself reports no URI.

The name is normalized the same way `openFiles` normalizes it before registering
readables, so a metadata read and a scan of the same readable share one cache
entry rather than landing on two.

Also pass the readable's known length, so a read that resolves against a cached
footer validates it against the file size instead of trusting it blindly.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wt7vVoiJrjxHyDvy4XDjsW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants