Skip to content

JVM insert_arrow and insert_dataframe: string column from Arrow's buffers - #571

Draft
tae898 wants to merge 1 commit into
mainfrom
perf/324-arrow-string-buffers
Draft

tae898 wants to merge 1 commit into
mainfrom
perf/324-arrow-string-buffers

Conversation

@tae898

@tae898 tae898 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

On the JVM wheel, insert_arrow and insert_dataframe now build a string column from Arrow's own buffers. An Arrow string or large string column is already int offsets plus one UTF-8 blob, which is what the bridge's StringColumn takes. Before, each batch went through to_pylist (one Python str per row) and core._string_column encoded those again. This is the "Arrow and DataFrame string columns are first turned into Python lists" item that #324 left open after #334. The offsets are rebased (a batch of to_batches is a slice of the table), and a chunk the buffers cannot carry (empty, a blob of 2 GiB or more, a null row that holds text) keeps the to_pylist route. The native wheel and the Java code are not touched.

Still open on #324 after this: object columns that mix types, and the string columns of append_samples.

Related issues

Refs #324 and #315.

Performance changes

Not measured. The change removes one Python str and one encode per row, but this PR states no speed or memory figure until a timed A/B of a CI-built JVM wheel has run, so it stays draft until that run is read.

Docs

None: no page describes how a string column crosses.

Checklist

  • A regression test fails on the old code and passes on the new (tests/test_arrow_string_column_jvm.py: 4 of 5 fail on main, all pass here; JVM overlay on the 26.12.1.dev0 wheel, with the other Arrow and DataFrame tests, 302 passed)
  • The test suite that the change can affect passes (see the checks)
  • uvx pre-commit run --files <changed files> passes

…ow's buffers (#324)

An Arrow string column is already offsets plus one UTF-8 blob, which is the StringColumn layout. The batch went through to_pylist (one str per row) and core._string_column encoded those again. dataframe._arrow_string_column now rebases the offsets (a to_batches batch is a slice), narrows them to int32 and sends the bytes between the first and the last offset. A chunk it cannot take (empty, a blob of 2 GiB or more, a null row that holds text) keeps the to_pylist route.
No speed claim: not timed.

This branch has not been deployed

No deployments
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.

1 participant