From 45ce4188688a30191ca72e8c7599e9977fa6389d Mon Sep 17 00:00:00 2001 From: niuyulin Date: Wed, 5 Aug 2026 15:38:01 +0800 Subject: [PATCH] fix(index): allow date32 ordered scalar indexes --- lance_ray/index.py | 3 ++- tests/test_vector_index_options.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lance_ray/index.py b/lance_ray/index.py index b36b4e3a..e066d291 100755 --- a/lance_ray/index.py +++ b/lance_ray/index.py @@ -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": diff --git a/tests/test_vector_index_options.py b/tests/test_vector_index_options.py index b114ef70..6829700d 100644 --- a/tests/test_vector_index_options.py +++ b/tests/test_vector_index_options.py @@ -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() @@ -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) @@ -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()), ] ) @@ -452,6 +455,7 @@ def test_create_index_rejects_invalid_num_segments(monkeypatch): ("index_type", "column"), [ ("BTREE", "value"), + ("BTREE", "event_date"), ("BITMAP", "value"), ("INVERTED", "text"), ("FTS", "text"), @@ -459,6 +463,7 @@ def test_create_index_rejects_invalid_num_segments(monkeypatch): ("BLOOMFILTER", "value"), ("RTREE", "value"), ("LABEL_LIST", "labels"), + ("ZONEMAP", "event_date"), ], ) def test_create_scalar_index_uses_segment_path(monkeypatch, index_type, column):