Repository navigation
Description
SDK
Python
Problem
StreamingDataset always constructs a new in-memory permutation in __init__:
lancedb/python/python/lancedb/streaming.py
Lines 282 to 299 in f39a7a4
| # Build the permutation table once, deterministically. | |
| builder = permutation_builder(table) | |
| if filter is not None: | |
| builder = builder.filter(filter) | |
| if shuffle: | |
| perm_seed = shuffle_seed + epoch * _EPOCH_PRIME | |
| self._perm_table = builder.split_random( | |
| fixed=num_splits, seed=perm_seed, clump_size=shuffle_clump_size | |
| ).execute() | |
| else: | |
| self._perm_table = builder.split_sequential(fixed=num_splits).execute() | |
| # Contiguous block of global split indices assigned to this rank. | |
| splits_per_rank = num_splits // world_size | |
| rank_start = rank * splits_per_rank | |
| self._rank_splits: list[int] = list( | |
| range(rank_start, rank_start + splits_per_rank) | |
| ) |
In a typical torchrun job, every rank therefore repeats the filtered row-ID scan, sort, shuffle, and plan materialization. A caller can persist a normal permutation table separately, including on local NVMe while the base table is in S3 or behind a query node, but StreamingDataset cannot consume it.
This adds startup work and client memory and makes it harder to reuse one reviewed training plan across ranks and later runs.
Desired behavior
Allow StreamingDataset to open a caller-supplied permutation table (or equivalent persisted plan handle) instead of always building a new one.
Acceptance criteria
- Accept a prebuilt permutation table containing
row_idandsplit_idfor either a direct or remote base table. - Construction with a supplied plan performs no base-table planning scan.
- All ranks can open the same immutable plan and receive the same split assignments as the current internally built path.
- Validate the requested split count and reject incompatible plan metadata rather than silently rebuilding.
- Permit the plan table and base table to use different connections, for example a local-NVMe plan with an
s3://base table. - Define worker serialization without requiring every spawned worker to materialize an independent Arrow copy of a large persisted plan.
- Add direct and mocked-remote tests, including more than one rank and spawned DataLoader workers.
Out of scope
This issue is about reusing row order and split membership. It does not cache projected feature or audio bytes and does not define weighted sampling or duration batching.
Activity
Sravan1011 commentedon Aug 25, 2026
@sarwarbhuiyan can I try this out ?
sarwarbhuiyan commentedon Aug 25, 2026
Sure try it.