mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-14 07:42:28 +00:00
fix: omit unfetchable list blobs from column discovery
This commit is contained in:
@@ -1920,7 +1920,11 @@ class Table(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def blob_columns(self) -> list[str]:
|
||||
"""Names of the blob v2 columns declared on this table."""
|
||||
"""Names of blob v2 columns that can be fetched by row id.
|
||||
|
||||
Struct-nested blobs use dotted paths. Blobs inside lists are omitted
|
||||
because a row id does not identify an individual list element.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def fetch_blobs(
|
||||
@@ -1936,6 +1940,8 @@ class Table(ABC):
|
||||
|
||||
Convenience for small payloads. For large values use
|
||||
:meth:`fetch_blob_files`.
|
||||
|
||||
Blobs inside lists cannot be fetched by row id yet.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -660,12 +660,18 @@ def test_merge_insert_list_blob_dicts():
|
||||
|
||||
def test_list_blob_column_queries_as_raw_descriptors():
|
||||
table = _list_blob_table("list_query")
|
||||
assert table.blob_columns() == []
|
||||
hits = table.search().limit(10).to_arrow()
|
||||
element = hits.schema.field("images").type.value_type
|
||||
assert pa.types.is_struct(element)
|
||||
assert "_lance_row_id" not in element.names
|
||||
with pytest.raises(ValueError, match="expected struct before segment"):
|
||||
table.fetch_blobs("images.image", [0])
|
||||
for column in ("images", "images.image"):
|
||||
with pytest.raises(ValueError, match="blobs inside lists cannot be fetched"):
|
||||
table.fetch_blobs(column, [0])
|
||||
with pytest.raises(ValueError, match="blobs inside lists cannot be fetched"):
|
||||
table.fetch_blob_files(column, [0])
|
||||
with pytest.raises(ValueError, match="blobs inside lists cannot be fetched"):
|
||||
table.fetch_blob_ranges(column, [(0, 0, 1)])
|
||||
|
||||
|
||||
def test_row_addressable_paths_exclude_list_children():
|
||||
|
||||
Reference in New Issue
Block a user