Skip to content

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

Closed

Description

@shaunpatterson

Summary

A result whose rows have no properties (a vertex or document created with none, SELECT FROM V over such records) has N rows in to_list(), to_json_list() and count(), but no rows in to_dataframe(), to_arrow(), to_columns() and to_polars(). The rows disappear without a message, on both wheels.

Reproduction

import tempfile

import arcadedb

print(arcadedb.__backend__, arcadedb.__version__)
with arcadedb.create_database(tempfile.mkdtemp() + "/db") as db:
    db.command("sql", "CREATE VERTEX TYPE V")
    with db.transaction():
        for _ in range(3):
            db.command("sql", "CREATE VERTEX V")

    q = "SELECT FROM V"
    print("to_list rows      :", len(db.query("sql", q).to_list()))
    print("count()           :", db.query("sql", q).count())
    print("to_dataframe shape:", db.query("sql", q).to_dataframe().shape)
    print("to_columns        :", db.query("sql", q).to_columns())
    table = db.query("sql", q).to_arrow()
    print("to_arrow          :", table.num_rows, "rows,", table.num_columns, "columns")

Output, identical on both wheels (arcadedb-jvm 26.12.1.dev0 built from main at 0c3c7ec, and arcadedb 26.11.1.post4; macOS arm64, Python 3.12):

to_list rows      : 3
count()           : 3
to_dataframe shape: (0, 0)
to_columns        : {}
to_arrow          : 0 rows, 0 columns

Cause

The readers learn the column names from the frames, and merge_columns and merge_arrow (src/arcadedb/_columnar.py) start with if not batches or not names: return empty_columns(columns) or empty_arrow(columns). A frame of N rows with no property reports count=N and no column, so the row count is dropped with the names.

Expected

to_dataframe() has N rows and no columns, (3, 0) here, as pandas.DataFrame([{}, {}, {}]) has. to_arrow() can carry N rows with no column (pa.RecordBatch.from_struct_array(pa.array([{}] * 3, pa.struct([]))) has 3 rows).

to_columns() returns a dict of columns and to_polars() a frame built from them, and neither can show a row count without a column. For those two I see no change that is not a decision about the contract (for example a documented note), so I would like your preference before writing a patch: fix to_dataframe() and to_arrow() and document the other two, or something else.

Activity

  1. added
    jvm
    python
    on Nov 21, 2026
  2. added this to the 26.12.1 milestone on Nov 21, 2026
  3. added
    in progress
    on Nov 22, 2026
  4. added 5 commits that reference this issue on Nov 22, 2026
  5. tae898 commented on Nov 22, 2026

    @tae898
    Collaborator

    Thanks for the report, the repro made this quick to find. It is fixed in #435: rows that have no property now keep their count in to_arrow(), to_polars() and to_dataframe() (a table or frame of that many rows and no column). to_columns() still returns {} for such a result, because a dict of columns has no place for a row count, and the docs say so now. It will be in 26.12.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in progressjvmpython

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions