Skip to content

PyArrow: Keep the row count when a scan selects no columns - #4161

Open
vibhuthespeedst wants to merge 1 commit into
apache:mainfrom
vibhuthespeedst:fix-empty-projection-row-count
Open

vibhuthespeedst wants to merge 1 commit into
apache:mainfrom
vibhuthespeedst:fix-empty-projection-row-count

Conversation

@vibhuthespeedst

Copy link
Copy Markdown

Closes #4137

Rationale for this change

table.scan(selected_fields=()).to_arrow() returned 0 rows instead of the row count with no columns. Two places lost the rows: _to_requested_schema builds the struct from zero fields, which has length 0, and ArrowScan.to_table uses pa.concat_tables, which drops the rows of tables without columns.

Are these changes tested?

Yes, two tests in tests/io/test_pyarrow.py, with and without a row filter. Both fail without the fix.

Are there any user-facing changes?

Scans that select no columns now return the right number of rows.

Generated-by: AI assistant

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.

Scan with an empty projection (selected_fields=()) returns 0 rows

1 participant