mirror of
https://github.com/lancedb/lancedb.git
synced 2026-05-14 18:40:39 +00:00
update
This commit is contained in:
@@ -781,11 +781,10 @@ class Permutation:
|
||||
|
||||
def fetch(self, indices: list[int]) -> Any:
|
||||
"""
|
||||
Fetch rows from the permutation by offset.
|
||||
Fetch rows from the permutation
|
||||
|
||||
This is the public batch-access API. It returns the rows for the given
|
||||
offsets in the same shape as configured by
|
||||
[with_format](#with_format) / [with_transform](#with_transform).
|
||||
returns the rows for the given permutation in the same shape as configured by
|
||||
with_format / with_transform.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
@@ -1098,20 +1098,5 @@ def test_getitems_invalid_offset(some_permutation: Permutation):
|
||||
|
||||
|
||||
def test_fetch_matches_getitems(some_permutation: Permutation):
|
||||
"""Public fetch() should be equivalent to __getitems__."""
|
||||
indices = [0, 1, 2, 10, 100]
|
||||
assert some_permutation.fetch(indices) == some_permutation.__getitems__(indices)
|
||||
|
||||
|
||||
def test_fetch_respects_format(some_permutation: Permutation):
|
||||
"""fetch() applies the configured format/transform."""
|
||||
arrow_perm = some_permutation.with_format("arrow")
|
||||
result = arrow_perm.fetch([0, 1, 2])
|
||||
assert isinstance(result, pa.RecordBatch)
|
||||
assert result.num_rows == 3
|
||||
|
||||
|
||||
def test_fetch_invalid_offset(some_permutation: Permutation):
|
||||
"""fetch() with an out-of-range offset raises an error."""
|
||||
with pytest.raises(Exception):
|
||||
some_permutation.fetch([999999])
|
||||
|
||||
Reference in New Issue
Block a user