NVIDIA-NeMo / NVIDIA-NeMo/Curator

split_large_files: RecursionError when a single parquet row exceeds the target size

Open Beginner friendly
#2,375 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

community-request waiting-on-maintainers
Dominant language
Python
Stars
1.8k
Forks
328
Avg merge
4d 5h
Merged PRs (30d)
30

Description

Description

split_large_files.py's _split_table recurses forever (ends in RecursionError) when a parquet chunk contains a single row that is itself larger than the target size. There is no base case for num_rows <= 1, so the bisection keeps slicing the same 1-row table in half (1 // 2 = 0) forever.

This is realistic for interleaved-document parquet files with large embedded payloads (e.g. base64 images) — one 3 MB row with --target-size-mb 1 kills the tool.

Steps to reproduce
import pyarrow as pa
from nemo_curator.utils.split_large_files import _split_table

t = pa.table({"text": ["x" * 3_000_000]})
list(_split_table(t, 1024 * 1024))
# RecursionError
Expected behavior

A row that can't be split further becomes its own shard (same behavior the JSONL splitter documents for oversized single records — write it alone, ideally with a warning), and the tool finishes.

Actual behavior

_split_table slices [0 : n//2] and [n//2 : n]; for n=1 both slices are 1-row/0-row tables that never get smaller → infinite recursion.

Environment

nemo-curator main (93b48525), Python 3.12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in split_large_files.py at the _split_table entry point and run the provided pyarrow reproduction with a single 3 MB row and a 1 MB target. Ensure a row that cannot be split further is emitted as its own shard rather than recursing, and verify the reproduction completes without RecursionError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.