Skip to content

feat(jni): make Java read coalescing configurable - #95

Merged
ChristopherWirt merged 2 commits into
developfrom
cwirt/java-read-coalescing
Nov 9, 2026
Merged

ChristopherWirt merged 2 commits into
developfrom
cwirt/java-read-coalescing

Conversation

@ChristopherWirt

@ChristopherWirt ChristopherWirt commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #94.

Java-backed scans hard-code a 64 KiB coalescing gap and a 16 MiB max merged read. Callers can't trade extra bytes read for fewer object-storage requests.

This PR makes both limits configurable and keeps the current defaults.

Changes

  • NativeReadable: new default methods coalesceDistance() and coalesceMaxSize(). Native code reads them once when each source is registered, for scans and metadata/statistics reads.
  • Spark: new options vortex.read.coalesce.distance and vortex.read.coalesce.maxSize, in bytes and case-insensitive. They flow through VortexIo to HadoopReadable and are validated on the driver before broadcast.
  • Native validation: the distance must be >= 0 and the max size > 0. Max sizes near Integer.MAX_VALUE are capped to leave room for alignment padding within the ByteBuffer limit. Chunking oversized reads instead is tracked in jni: split oversized Java reads into chunks instead of capping coalesce max size #104.
  • README: documents the options and the trade-off between request count and bytes read.

Upstream has no equivalent Java setting. The closest work is vortex-data#11338, which changes DataFusion coalescing.

Validation

  • cargo clippy -p vortex-jni --all-targets --all-features -- -D warnings
  • cargo nextest run -p vortex-jni: 102 passed
  • :vortex-jni:test --tests NativeIOBridgeTest: passed
  • :vortex-spark-4.0_2.13:test --tests 'dev.vortex.spark.io.*': passed
  • Spotless; git diff --check

Spark 3.5 modules and benchmarks were not run.

🤖 Generated with Claude Code

- Parse Spark read options once into a ReadSettings record shared by create/broadcast
- Drop HadoopReadable's duplicate coalescing checks; native registration validates them
- Give non-positive maxSize a single '> 0' error and bump VortexIo serialVersionUID
- Restore the rationale for the 64 KiB default gap
- Dedupe test dispatch and use the named default constants in tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Christopher Wirt <[email protected]>
@ChristopherWirt
ChristopherWirt merged commit 3eced8d into develop Nov 9, 2026
1 check passed
ChristopherWirt added a commit that referenced this pull request Nov 10, 2026
Sets the default Java read coalescing gap back to 1 MiB, from the 64 KiB
#95 chose.

- Upstream's port (vortex-data#11369) keeps 1 MiB, so this keeps
our defaults the same as upstream's.
- Readers that want 64 KiB can still set
`vortex.read.coalesce.distance`.

Tested: `:vortex-spark-4.0_2.13:test --tests 'dev.vortex.spark.io.*'`
(28 passed).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make JavaReadable's coalescing gap configurable from Java

2 participants