Repository navigation
Conversation
When getcol is given a result buffer, selection indices past the end of a variably shaped cell are treated as -1 indices: they are not read and leave the result untouched. This lets dask-ms read chunks of a maximal shape directly over ragged cells, instead of reading whole cells and slicing in numpy. Per-row cell extents generalise to cell bounds, an upper bound on the disk indices read from each cell in both selected and unselected dimensions. Selections are rewritten once when all rows share a bound, and the data partition masks indices per row otherwise. Fixed shape columns, reads without a result and writes still raise. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Treating this as an unlikely edge case for now. Closing. |
This branch was successfully 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
Reading a variably shaped column with a secondary-dimension selection fails if any selected cell is shorter than the selection:
dask-ms hits this whenever it chunks a secondary dimension of a ragged column (e.g.
chanchunked as(3, 1)over cells with 4 and 2 channels). To avoid it, dask-ms reads whole cells into a buffer of the maximal shape and slices the block out in numpy, so each row is read once per chunk.With this PR, when
getcolis given aresultbuffer, selection indices past the end of a variably shaped cell are handled like-1indices: they are not read, and those positions of the result are left untouched. This matches #247, which pads result buffers that are larger than a cell. dask-ms can then pass each block's selection straight through.Implementation
RebuildSelectionrewrites the selection once, replacing the out-of-range indices with-1. Blocks that fit inside every cell keep the original selection.DataPartition::Makemasks each row's disk indices against that row's bound. This reuses the per-row path from Validate and pad cell shapes on reads and writes, fix GIL deadlock #247.Limits (these cases still raise)
result: arcae allocates the buffer uninitialised, so skipped positions would contain garbage.putcolpast the end of an existing cell is a genuine shape mismatch.Behaviour change: on a variably shaped column with a
resultbuffer, an index that is past the end of every cell now pads silently instead of raising. A variably shaped column has no overall bound to check against, and a block lying entirely past a group of short rows is a legitimate dask-ms read.Tests
result_shape_test): common-bound rewriting with unsorted indices, a selection entirely past the cells, per-row bounds, fixed-shape columns still raising, andMakeReadwithout a result still raising.test_getcol_selection_past_cellcompares reads against a NumPy reference computed row by row. It covers row orders, unsorted and explicit-1channel selections, undefined rows, and correlation padding. Also added:test_putcol_selection_past_cell, and an updatedtest_getcol_result_explicit_padding.ctest10/10 passed;pytest238 passed, 4 skipped, 1 xfailed.🤖 Generated with Claude Code