Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lance_ray/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,13 @@ def create_scalar_index(
is_supported = (
pa.types.is_integer(value_type)
or pa.types.is_floating(value_type)
or pa.types.is_date32(value_type)
or pa.types.is_string(value_type)
or pa.types.is_large_string(value_type)
)
if not is_supported:
raise TypeError(
f"Column {column} must be numeric or string type for "
f"Column {column} must be numeric, date32, or string type for "
f"{index_type} index, got {value_type}"
)
case "LABEL_LIST":
Expand Down
7 changes: 6 additions & 1 deletion tests/test_vector_index_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def id(self):

class _FakeLanceSchema:
def field(self, column):
if column not in {"value", "text", "labels"}:
if column not in {"value", "text", "labels", "event_date"}:
raise KeyError(column)
return _FakeLanceField()

Expand All @@ -84,6 +84,8 @@ def field(self, column):
return _FakeField(column, index_mod.pa.string())
if column == "labels":
return _FakeField(column, index_mod.pa.list_(index_mod.pa.string()))
if column == "event_date":
return _FakeField(column, index_mod.pa.date32())
else:
raise KeyError(column)

Expand All @@ -94,6 +96,7 @@ def __iter__(self):
_FakeField("value", index_mod.pa.int64()),
_FakeField("text", index_mod.pa.string()),
_FakeField("labels", index_mod.pa.list_(index_mod.pa.string())),
_FakeField("event_date", index_mod.pa.date32()),
]
)

Expand Down Expand Up @@ -452,13 +455,15 @@ def test_create_index_rejects_invalid_num_segments(monkeypatch):
("index_type", "column"),
[
("BTREE", "value"),
("BTREE", "event_date"),
("BITMAP", "value"),
("INVERTED", "text"),
("FTS", "text"),
("NGRAM", "text"),
("BLOOMFILTER", "value"),
("RTREE", "value"),
("LABEL_LIST", "labels"),
("ZONEMAP", "event_date"),
],
)
def test_create_scalar_index_uses_segment_path(monkeypatch, index_type, column):
Expand Down
Loading