Skip to content

Rows without properties keep their count in to_arrow, to_polars and to_dataframe - #435

Merged
tae898 merged 2 commits into
mainfrom
fix/429-rows-without-properties
Nov 22, 2026
Merged

tae898 merged 2 commits into
mainfrom
fix/429-rows-without-properties

Conversation

@tae898

@tae898 tae898 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #429

Thank you @shaunpatterson for the report and the clear cause. On the question you left open: to_arrow(), to_polars() and to_dataframe() now keep the rows, and to_columns() stays {} and is documented, because a dict of columns has no place for a row count.

What changes, in the decoder both wheels share (src/arcadedb/_columnar.py) and the two readers:

  • merge_arrow: frames with rows and no column name give a table of N rows and no column (pa.Table.from_struct_array of N empty structs; pa.table({}) has no rows). to_polars() reads that table.
  • to_dataframe(): the reader hands the row count over next to the dict of columns (_read_columns_counted on the JVM build, _columns_counted on the native one), and dataframe_from_columns returns a frame of N rows and no column, as pandas.DataFrame([{}, {}, {}]) is.
  • to_columns(): unchanged, {}. Its docstring on both builds and dataframes-and-columns.adoc say why and what to read instead.

Tests: test_rows_without_properties_keep_their_count (at batch_size 25,000 and 2) and test_an_empty_result_is_still_empty_in_every_reader in tests/test_columnar_readers.py.

Checked: compile() on the four Python files, uvx pre-commit run --files on the five files, and the shared decoder called directly with pyarrow 26.0.1 and pandas 3.1.1 (3 rows and no column from merge_arrow and dataframe_from_columns; an empty result stays empty). I reproduced the bug on the published arcadedb 26.11.1.post4 first (3 rows in to_list(), 0 in to_arrow() and to_dataframe()). I did not run the two new tests on a built wheel; the platform jobs of this pull request do.

@tae898 tae898 added bug Something isn't working python Pull requests that update python code labels Nov 22, 2026
@tae898 tae898 added this to the 26.12.1 milestone Nov 22, 2026
@tae898

tae898 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

The first run failed on the free-threaded leg (Python 3.14t): that leg runs test_columnar_readers.py without Polars, and my new test imported it. I moved the to_polars() assertion into test_dataframe_columns_behavior.py, which only runs where Polars is installed. The fix itself is unchanged.

@tae898
tae898 force-pushed the fix/429-rows-without-properties branch from 38a35ec to af95423 Compare November 22, 2026 12:17
…o_dataframe

A result whose rows have no property (records created with none) had N rows in to_list() and count() and no row in the columnar readers: merge_arrow and merge_columns returned the empty result whenever there were no column names, and the row count went with them. merge_arrow now returns a table of N rows and no column, and to_dataframe gets the row count next to the dict of columns on both wheels, so it returns a frame of N rows and no column. to_polars follows to_arrow.

to_columns() keeps returning {} for such a result: a dict of columns has no place for a row count. Its docstring and the how-to page say so.

Closes #429
The free-threaded leg (Python 3.14t) runs test_columnar_readers.py without Polars installed, so the import in the new test failed there. The to_polars() assertion is now its own test in test_dataframe_columns_behavior.py, which the legs without Polars do not run.
@tae898
tae898 force-pushed the fix/429-rows-without-properties branch from af95423 to 897ea1d Compare November 22, 2026 13:05
@tae898
tae898 merged commit effcf91 into main Nov 22, 2026
43 checks passed
@tae898
tae898 deleted the fix/429-rows-without-properties branch November 22, 2026 14:24
@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 python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_dataframe/to_arrow/to_columns drop the rows of a result whose rows have no properties

1 participant