perf: use PyArrow fast path for JSONL reads - #2325
Open
praateekmahajan wants to merge 6 commits into
Open
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
|
🌿 Preview your docs: https://nvidia-preview-codex-pr2303-jsonl-arrow.docs.buildwithfern.com/nemo/curator Here are the markdown pages you've updated: |
praateekmahajan
force-pushed
the
codex/pr2303-jsonl-arrow
branch
from
August 20, 2026 23:20
9f31d09 to
b391189
Compare
praateekmahajan
commented
Aug 20, 2026
praateekmahajan
commented
Aug 20, 2026
praateekmahajan
commented
Aug 20, 2026
Contributor
Author
|
/ok to test |
Signed-off-by: Praateek <praateekm@gmail.com>
Signed-off-by: Praateek <praateekm@gmail.com>
Signed-off-by: Praateek <praateekm@gmail.com>
Signed-off-by: Praateek <praateekm@gmail.com>
Signed-off-by: Praateek <praateekm@gmail.com>
praateekmahajan
force-pushed
the
codex/pr2303-jsonl-arrow
branch
from
August 21, 2026 17:57
2155137 to
01423d0
Compare
Signed-off-by: Praateek <praateekm@gmail.com>
Contributor
Author
|
@claude review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This PR makes direct PyArrow parsing the default for JSONL files and keeps the result as a
pa.Tableuntil a stage actually needs pandas.Reader-side
_curator_dedup_idgeneration and assignment now work with both Arrow tables and pandas DataFrames. As a result,LanceReadernow supports_generate_idsand_assign_idswithout converting its Arrow output to pandas first.When pandas is needed,
DocumentBatch.to_pandas()handles the conversion and preserves Arrow-backed string columns.Choosing an engine
JSONL reads use direct PyArrow parsing by default. Callers can select
engine="pandas"when they need pandas-specific parsing or type inference.The two engines do not always infer identical types. For example, pandas may interpret an ISO
created_atvalue as a timezone-aware datetime while PyArrow retains it as a string. Mixed-type columns are another situation where the pandas engine may be the better fit.The PyArrow path continues to support remote files through
fsspec. It normally reads with an 8 MiB block. If PyArrow reports that a single JSONL record straddles the block boundary, the reader retries with progressively larger blocks so that it can read the complete row. The 256 MiB maximum is a safety ceiling for unusually large individual records, such as rows containing a base64-encoded image or PDF; it is not the default amount read for every row.Lance and reader IDs
Because ID handling lives in
BaseReader, Arrow-backed Lance reads now support_generate_idsand_assign_idstoo.Lance tasks use a stable identity based on the dataset path, version, and fragment IDs. File readers retain their existing path-based registry keys for backward compatibility; NMCUR-315 tracks moving them to deterministic task IDs as well.
Compatibility
This work is based directly on
mainand does not depend on the RAPIDS/Pandas 3 upgrade in #2303. It is tested with the currentmainversions: pandas 2.3.3 and PyArrow 19.0.1.Testing
The tests cover:
fsspecinputsDocumentBatchArrow-string conversionBenchmarks
The table compares the latest completed
mainnightly (nightly-2026_08_20__06_39_17_UTC) with this PR (pr-2325-2026_08_21__00_25_05_UTC-519ad6a9). Reader time is the meanjsonl_reader_process_timeper task. Lower is better.domain_classification_raydatadomain_classification_xennaembedding_generation_raydataembedding_generation_xennadedup_removal_raydatadedup_removal_xennascore_filter_raydatascore_filter_xennafasttext_filter_raydatafasttext_filter_xennamodifier_raydatamodifier_xennandd_dynamo_dp8ndd_ray_serve_dp8Across all 14 entries, the median JSONL reader task is 75.2% faster and median E2E runtime improves by 2.0%. Looking only at the 12 entries where JSONL reading is not the dominant cost, median E2E runtime improves by 0.8%.