Skip to content

Commit e4d9c3c

Browse files
committed
fix python test
Signed-off-by: Andrew Duffy <[email protected]>
1 parent 86634a5 commit e4d9c3c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

vortex-layout/src/layouts/flat/reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl LayoutReader for FlatReader {
8787
row_range: &Range<u64>,
8888
splits: &mut BTreeSet<u64>,
8989
) -> VortexResult<()> {
90-
splits.insert(row_range.end);
90+
splits.insert(row_range.start + self.layout.row_count);
9191
Ok(())
9292
}
9393

vortex-python/test/test_dataset.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,25 +175,19 @@ def test_fragment_to_batch_size(ds: vx.dataset.VortexDataset, batch_size: int):
175175

176176
remainder = 0
177177
for f in fragments:
178+
# The fragments have ranges based on the natural splits.
179+
# We read batches in units of `batch_size` though.
178180
batch_sizes = [len(batch) for batch in f.to_batches(batch_size=batch_size)]
179-
if remainder != 0:
180-
assert batch_sizes[0] == remainder
181-
batch_sizes = batch_sizes[1:]
182-
n_rows = f.count_rows() - remainder
183-
else:
184-
n_rows = f.count_rows()
181+
n_rows = f.count_rows() - remainder
185182

186183
if n_rows < batch_size:
187184
assert batch_sizes == [n_rows]
188-
remainder = 0
189185
elif n_rows % batch_size == 0:
190186
assert batch_sizes == [batch_size for _ in batch_sizes]
191-
remainder = 0
192187
else:
193188
last_batch_size = n_rows % batch_size
194189
assert batch_sizes[:-1] == [batch_size for _ in batch_sizes[:-1]]
195190
assert batch_sizes[-1] == last_batch_size
196-
remainder = batch_size - last_batch_size
197191

198192

199193
def test_fragment_to_table(ds: vx.dataset.VortexDataset):

0 commit comments

Comments
 (0)