Add keyed sample lookup and in-place dataset_update - #868
Merged
Conversation
Write a keys/shard parquet store during optimize(key_fn=...), expose StreamingDataset entity-key reads, and allow Session-style commits that rewrite only touched chunks for surgical value patches. Co-authored-by: Cursor <cursoragent@cursor.com>
for more information, see https://pre-commit.ci
Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent xdist workers from sharing /tmp/chunks, which left stale bins and index files that broke cleanup checks and config merges. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #868 +/- ##
=====================================
- Coverage 81% 81% -1%
=====================================
Files 56 58 +2
Lines 9303 10124 +821
=====================================
+ Hits 7563 8166 +603
- Misses 1740 1958 +218 🚀 New features to boost your workflow:
|
Close index.json before enrich/write_keys_store replaces it, and retry atomic replaces briefly for antivirus file-lock races on Windows. Co-authored-by: Cursor <cursoragent@cursor.com>
DatasetUpdate and key scans left BinaryReader mmaps open, so replacing *.bin on Windows failed with Access Denied even after index.json fixes. Co-authored-by: Cursor <cursoragent@cursor.com>
If an open StreamingDataset still mmaps a chunk, publish chunk-R-I-uN.bin and retarget index.json instead of failing Access Denied on replace. Co-authored-by: Cursor <cursoragent@cursor.com>
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
optimize(..., key_fn=...)support that writeskeys/shard-*.parquetand records layout inindex.json["keys"].StreamingDataset["entity-id"](int indexes stay sample indexes).dataset_update: stage replaces, thencommit()to rewrite only touched chunks; exit without commit discards.build_keys_indexto backfill keys for datasets optimized withoutkey_fn.This is aimed at surgical value patches under a stable schema (fix/relabel specific entity IDs), not schema-wide table redesigns that touch every joined row.
API design
Layout
Shard parquet columns (sorted by
key):key,index,chunk_index,chunk_offset.Key-store metadata lives in
index.json["keys"]— no separate manifest file.Default is one shard (
num_shards=1). Lookups use lazy Polarsscan_parquet+ predicate pushdown (remote-friendly).Write keys at optimize time
Read by entity key
In-place update (Session-style)
Backfill keys for an existing dataset
Test plan
pytest tests/streaming/test_dataset_update.py(18 passed)/teamspace/lightning_storage/testing/keys_demo: optimize + keyed read + commit + discard-without-commit