Repository navigation
Read events.parquet by row group when over the cap - #1499
Merged
Merged
Conversation
A 120,000-row file in three row groups, sorted by store_path with statistics, one store straddling a boundary; the same rows without statistics; and the oversized file's rows moved under a store the index knows, so reading by row group is over the cap too (#1498). Tested: generated with scripts/zarr/generate_mcp_test_fixture.py; row groups and statistics checked with pyarrow.
get_events refused every recording of a dataset whose events.parquet was over the row cap: nm000132 (ERP CORE) is 2.4 MB but 153,722 rows. It now reads only the row groups whose store_path statistics can hold the recording asked for, applies the caps to those, and caches only that recording (#1498). A file without statistics, or a recording whose own row groups are over a cap, is still declined, saying which. Tested: mcp-recording-tools.test.ts (44 pass), including the byte ranges read; 10 single-line mutations each fail it; full bun test (7510 pass, 0 fail), typecheck, biome.
NEMAR's example dataset is now ERP CORE; the dataset id description every MCP tool carries names it instead of nm000329. Tested: typecheck; mcp-recording-tools.test.ts passes.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1499Version: 🤖 Updated on each push. |
Contributor
Author
Review responseOne Sonnet review. One finding, fixed in the latest commit: a The review confirmed against hyparquet 1.30.0's own source that
Two mutations of its own (keeping other stores' rows, an off-by-one on the max bound) each failed the suite. |
5 tasks
This was referenced Sep 24, 2026
Merged
This branch was previously deployed
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.
Summary
Closes #1498.
get_eventsrefused every recording of a dataset whoseevents.parquetwas over the whole-file cap, even when the request named one recording. nm000132 (ERP CORE), NEMAR's example dataset, is 2.4 MB but 153,722 rows, so every one of its 240 recordings was declined, each only a few hundred rows.The converter writes the file sorted by
store_path, and every row group carries min/max statistics for it (write_events_parquetinscripts/zarr/generate_zarr.py). So the row groups that can hold a recording are known from the footer alone. For a file over a cap,get_eventsnow reads only those row groups and applies the same caps to them instead of the file.Changes
storeRowGroupSpan(backend/src/mcp/tools/get-events.ts): the contiguous run of row groups whosestore_pathstatistics can contain the store, with its row count and compressed bytes. It returnsnullwhen any row group lacksmin_value/max_value(the deprecatedmin/maxare ignored; older writers compared them signed). Comparison is in UTF-8 byte order, as parquet's.rowStart/rowEndfor that run, and keeps and validates only the requested store's rows. On that path only the requested store is cached: the[]placeholders for other stores are written only after a whole-file read, since the other stores may continue into row groups that were not read.store_pathstatistics, and a recording whose own row groups are over a cap. The public URL remedy is unchanged.scripts/zarr/generate_mcp_test_fixture.py:row-groups-events.parquet: 120,000 rows in three row groups, with one store's 20 events across a boundary.no-stats-events.parquet: the same rows without statistics.oversized-events.parquet: its rows moved under a store the index has, so the existing "declined" test now exercises the per-recording cap.Testing
mcp-recording-tools.test.ts: 44 pass. The new cases cover:storeRowGroupSpanon the real footers, the UTF-8 byte order, and the deprecated statistics.bun test: 7510 pass, 0 fail.bun run typecheck, Biome on the changed files.Reaches the NEMAR assistant only through production (
mcp.nemar.org), so it needs the nextdevtomainrelease.