Repository navigation
fix(python): let VortexDataset.head return fewer rows than requested - #11384
Merged
robert3005 merged 3 commits intoNov 16, 2026
Merged
Conversation
head sliced the filtered array to num_rows, which fails when fewer rows match, and rejected batch_size, so scanner(batch_size=N).head(k) always raised. Read through the record batch reader that to_batches uses and pass num_rows to the scan as its limit. Fail a zero row count in SplitBy::RowCount, as LayoutSubSplitting does, instead of panicking. Signed-off-by: jackylee-ch <qcsd2011@gmail.com>
robert3005
reviewed
Nov 11, 2026
split_by is a low-level io/compute control, not a batch size, so head no longer maps batch_size to it and keeps rejecting batch_size. Drops the SplitBy::RowCount(0) guard, which head can no longer reach. Signed-off-by: jackylee-ch <qcsd2011@gmail.com>
robert3005
approved these changes
Nov 16, 2026
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
VortexDataset.head(n)raisedRuntimeError: OutOfBounds: stop 10 > length 5whenever fewer thannrows matched, where a pyarrow Parquet dataset returns the rows it has:head(10)on a 5-row file, orhead(10, filter=pc.field("x") > 3)matching one row.ds.scanner(batch_size=N).head(k)always raisedValueError: batch_size is not supported, althoughto_batchestakesbatch_size.Changes
headnow reads through the record batch reader thatto_batchesuses, withbatch_sizeas the split size andnum_rowsas a new scanlimit. A short result is returned as is, and the scan stops once it has enough rows: on a 20M-row file,head(10, filter=pc.field("i") > 5)grows peak RSS by 20 MiB instead of 109 MiB.SplitBy::RowCount(0), now reachable fromhead, panicked onstep_by(0); it returns an error, asLayoutSubSplittingdoes for a zeromax_rows.to_tablestill rejectsbatch_size, left for a follow-up.The new tests fail on
develop.AI assistance
Written with agentic AI assistance.