Skip to content

[C++][Python][ORC] Empty projections lose row counts in ORCFile reads #55773

Backlog

Description

@jiangxt2

Reading a nonempty ORC file with an empty column projection returns zero rows from ORCFile.read() and ORCFile.read_stripe(). The projection should contain no columns while retaining the number of rows.

import pyarrow as pa
import pyarrow.orc as orc

sink = pa.BufferOutputStream()
orc.write_table(pa.table({"value": [1, 2, 3]}), sink)
reader = orc.ORCFile(sink.getvalue())

print(reader.read(columns=[]).num_rows)
print(reader.read_stripe(0, columns=[]).num_rows)

Both calls return 0; the expected row count is 3. ORCFile.iter_batches(columns=[]) preserves row counts.

The issue was discussed in PR #54926. Reproduced with a local PyArrow 27 development build and ORC 2.2.1 on macOS arm64.

Components: C++, Python

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions