Skip to content

fix(#428): to_arrow and to_columns of differing rows do not depend on batch_size - #430

Merged
tae898 merged 1 commit into
ArcadeData:mainfrom
shaunpatterson:fix/columnar-type-independent-of-batch-size
Nov 22, 2026
Merged

tae898 merged 1 commit into
ArcadeData:mainfrom
shaunpatterson:fix/columnar-type-independent-of-batch-size

Conversation

@shaunpatterson

Copy link
Copy Markdown
Contributor

What does this PR do?

On the JVM wheel the type of a to_arrow() column and the values of a to_columns() column of differing rows depended on batch_size (#428). The rows of one frame and the rows of several frames went through two different merges. This PR makes the merge of frames give what one frame gives, which is also what the native wheel returns:

  • merge_columns no longer joins a bool with an int or float part through np.concatenate (True became 1); such a column is a list of the Python values, as in one frame.
  • _unify_arrow_chunk_types: struct chunks (maps with different keys) and list chunks (ints next to floats) are typed from all their values, as pa.array types the rows of one frame; a bool next to a float is double, as in one frame.
  • _cast_all_to_string writes str(v) (True, 1.0), as the fallback inside one frame does, instead of Arrow's cast (true, 1).
  • The docstring of _unify_arrow_chunk_types, which said there is no bool/int64 case, now describes these.

Related issues

Closes #428

Performance changes

None claimed. The new branches run only for a column whose chunks disagree in type; merge_columns adds one set of numpy dtype kinds per column.

Docs

None: the to_arrow docstring and how-to/dataframes-and-columns.adoc already say that a column's type does not depend on batch_size; the code now keeps that for these rows.

Checklist

  • A regression test fails on the old code and passes on the new (test_to_arrow_of_differing_rows_does_not_depend_on_batch_size and test_to_columns_of_differing_rows_keeps_what_to_list_returns, six kinds of differing rows; they pass on the published native wheel 26.11.1.post4 with and without the change, so the native result is the reference)
  • The test suite that the change can affect passes (every tests/ file that uses to_arrow, to_columns, to_dataframe, to_polars or _columnar, the test_native_* files excluded as conftest.py does; test_columnar_readers.py and test_column_frames.py also on the native package with this _columnar.py)
  • uvx pre-commit run --files <changed files> passes

… depend on batch_size

The merge of several frames and the rows of one frame gave different results for a bool next to a number,
maps with different keys and lists of ints next to floats. The merge now gives what one frame gives:
no np.concatenate of a bool with numbers, struct and list chunks typed from all their values, a bool next
to a float as double, and the text of a mixed column written by str() as inside one frame.
@tae898
tae898 merged commit 87c438c into ArcadeData:main Nov 22, 2026
44 checks passed
@github-actions github-actions Bot added this to the 26.12.1 milestone Nov 22, 2026
@tae898 tae898 added the bug Something isn't working label Nov 22, 2026
@tae898

tae898 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you, merged for 26.12.1.

@tae898 tae898 mentioned this pull request Nov 30, 2026
1 of 10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JVM to_arrow/to_columns: the type of a column of differing rows depends on batch_size

2 participants