Skip to content

[Python][Parquet] ParquetFile.iter_batches errors when row_groups is [] #45343

Closed as duplicate

Description

@Bill-Johnson-Seequent

Describe the bug, including details regarding any error messages, version, and platform.

As of version 18.0.0, ParquetFile.iter_batches throws an error when the row_groups parameter is an empty list.

This can be replicated with the following code (also available here).

from pathlib import Path

from pyarrow import parquet as pq


pq_file = pq.ParquetFile(Path('pyarrow-issue.parquet'))
all_batches = []

for batch in pq_file.iter_batches(row_groups=[]):
    all_batches.append(batch)

The stack trace is:

Traceback (most recent call last):
  File "/pyarrow-issue.py", line 9, in <module>
    for batch in pq_file.iter_batches(row_groups=[]):
  File "pyarrow/_parquet.pyx", line 1634, in iter_batches
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
OSError: The file only has 1 row groups, requested metadata for row group: -1

Have also seen the issue in PyArrow v18.1.0 and v19.0.0, but v17.0.0 does not have the issue. We are on Python version 3.12.3, running within WSL.

Note: The workaround was to wrap the call in a check to see that row_groups was not empty!

Component(s)

Python

Activity

  1. kou commented on Jan 24, 2025

    @kou
    Member

    #45339 may be the same problem.

  2. Bill-Johnson-Seequent commented on Jan 24, 2025

    @Bill-Johnson-Seequent
    Author

    Agreed - looks like it's likely the same underlying cause. Happy to retest this case when 19.0.1 comes out 😄

  3. raulcd commented on Jan 24, 2025

    @raulcd
    Member

    Thanks for opening it @Bill-Johnson-Seequent
    I am closing this as duplicate to have a single issue to track that.

  4. changed the title [-]ParquetFile.iter_batches errors when row_groups is [][/-] [+][Python][Parquet] ParquetFile.iter_batches errors when row_groups is [][/+] on Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions