Skip to content

feat: add task commit factory for Apache Gluten writes - #715

Draft
malinjawi wants to merge 1 commit into
lance-format:mainfrom
malinjawi:task-commit-factory
Draft

feat: add task commit factory for Apache Gluten writes#715
malinjawi wants to merge 1 commit into
lance-format:mainfrom
malinjawi:task-commit-factory

Conversation

@malinjawi

Copy link
Copy Markdown

Summary

  • add LanceBatchWrite.taskCommit(...) for external writers such as Apache Gluten
  • keep TaskCommit opaque
  • add API, serialization, and multi-fragment commit tests

Discussion: #709

Testing

  • mvn -pl lance-spark-base_2.12 test
  • make install-base SCALA_VERSION=2.13

@github-actions

Copy link
Copy Markdown
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@malinjawi malinjawi changed the title Add task commit factory for Apache Gluten writes feat: add task commit factory for Apache Gluten writes Jul 22, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Jul 22, 2026
yanghua pushed a commit that referenced this pull request Sep 2, 2026
## What

Adds `LanceArrowStreamScanner`, which plans a Lance fragment scan and
exports it as an Arrow C Data Interface stream (`ArrowArrayStream`) for
native consumers such as Apache Gluten / Velox.

## Why

This is the read-side building block for offloading Lance scans to a
native engine. Only the `ArrowArrayStream` C-struct address crosses the
JVM/native boundary, so the consumer's Arrow build and classloader do
not need to match lance-spark's — Gluten builds Arrow 15 to match Spark
3.5 / Velox, while the Lance Java SDK is on Arrow 18. Passing the raw
struct address sidesteps that mismatch entirely.

## How

- `LanceArrowStreamScanner.export(fragmentId, inputPartition)` returns a
`LanceArrowStream` handle exposing `stream()` / `streamAddress()`.
- All scan planning (column projection, filter pushdown, limit/offset,
row-id / row-address, batch size) is delegated to the existing
`LanceFragmentScanner`, so the exported stream yields exactly the same
rows in the same order as the Spark columnar reader.
- The Lance native core populates the caller-owned stream directly via
`LanceScanner#exportArrowStream(long)` (lance-format/lance#7259), so no
Arrow data is materialized on the JVM heap on this path.
- `LanceArrowStream` owns the exported stream and the scan behind it;
closing it releases the native scan (through the stream's release
callback) and then the scanner and dataset handles.

## Dependency

`exportArrowStream(long)` first ships in lance-core `11.0.0-beta.21`, so
this bumps `lance.version` from `11.0.0-beta.10` (isolated in its own
commit).

## Testing

- New `LanceArrowStreamScannerTest`: exports each fragment of the
bundled test table, re-imports it on the JVM (standing in for a native
consumer), and asserts the rows match the columnar reader — run under
the leak-checking allocator to verify the export/scanner lifecycle
releases cleanly.
- Existing `LanceFragmentColumnarBatchScannerTest` still passes
(regression on the touched `LanceFragmentScanner`).

## Related

- Complements #715 (Gluten write path).
- Distinct mechanism from #624 / #623 (serializable native scan
descriptor for datafusion-comet): this exposes a live Arrow C stream
handle rather than a re-plannable descriptor.

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant