This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new f6cb6c849f [python] vector lumina: python fix code (#7609)
f6cb6c849f is described below

commit f6cb6c849fc4ade93cf3366b79a4b2955b8919a2
Author: jerry <[email protected]>
AuthorDate: Wed Apr 8 11:28:58 2026 +0800

    [python] vector lumina: python fix code (#7609)
---
 .../lumina/lumina_vector_global_index_reader.py    | 58 +---------------------
 .../pypaimon/table/source/vector_search_read.py    | 13 ++---
 2 files changed, 6 insertions(+), 65 deletions(-)

diff --git 
a/paimon-python/pypaimon/globalindex/lumina/lumina_vector_global_index_reader.py
 
b/paimon-python/pypaimon/globalindex/lumina/lumina_vector_global_index_reader.py
index 3e65f910fc..2ec7acb9f5 100644
--- 
a/paimon-python/pypaimon/globalindex/lumina/lumina_vector_global_index_reader.py
+++ 
b/paimon-python/pypaimon/globalindex/lumina/lumina_vector_global_index_reader.py
@@ -23,6 +23,7 @@ index and performs vector similarity search using the 
lumina-data SDK.
 """
 
 import os
+import numpy as np
 
 from pypaimon.globalindex.global_index_reader import GlobalIndexReader
 from pypaimon.globalindex.vector_search_result import 
DictBasedScoredIndexResult
@@ -57,15 +58,7 @@ class LuminaVectorGlobalIndexReader(GlobalIndexReader):
         self._ensure_loaded()
 
         from lumina_data import MetricType
-
-        query = vector_search.vector
-        # Flatten to a plain list of floats for search_list API
-        if hasattr(query, 'tolist'):
-            query_flat = list(query.flatten()) if hasattr(query, 'flatten') 
else list(query)
-        else:
-            query_flat = list(query)
-        query_flat = [float(v) for v in query_flat]
-
+        query_flat = [float(v) for v in 
np.asarray(vector_search.vector).tolist()]
         expected_dim = self._index_meta.dim
         if len(query_flat) != expected_dim:
             raise ValueError(
@@ -152,50 +145,3 @@ class LuminaVectorGlobalIndexReader(GlobalIndexReader):
         if self._stream is not None:
             self._stream.close()
             self._stream = None
-
-    # =================== unsupported =====================
-
-    def visit_equal(self, field_ref, literal):
-        return None
-
-    def visit_not_equal(self, field_ref, literal):
-        return None
-
-    def visit_less_than(self, field_ref, literal):
-        return None
-
-    def visit_less_or_equal(self, field_ref, literal):
-        return None
-
-    def visit_greater_than(self, field_ref, literal):
-        return None
-
-    def visit_greater_or_equal(self, field_ref, literal):
-        return None
-
-    def visit_is_null(self, field_ref):
-        return None
-
-    def visit_is_not_null(self, field_ref):
-        return None
-
-    def visit_in(self, field_ref, literals):
-        return None
-
-    def visit_not_in(self, field_ref, literals):
-        return None
-
-    def visit_starts_with(self, field_ref, literal):
-        return None
-
-    def visit_ends_with(self, field_ref, literal):
-        return None
-
-    def visit_contains(self, field_ref, literal):
-        return None
-
-    def visit_like(self, field_ref, literal):
-        return None
-
-    def visit_between(self, field_ref, min_v, max_v):
-        return None
diff --git a/paimon-python/pypaimon/table/source/vector_search_read.py 
b/paimon-python/pypaimon/table/source/vector_search_read.py
index 4c8aa111da..02776ae085 100644
--- a/paimon-python/pypaimon/table/source/vector_search_read.py
+++ b/paimon-python/pypaimon/table/source/vector_search_read.py
@@ -86,22 +86,17 @@ class VectorSearchReadImpl(VectorSearchRead):
         file_io = self._table.file_io
         options = self._table.table_schema.options
 
-        reader = _create_vector_reader(
-            index_type, file_io, index_path,
-            index_io_meta_list, options
-        )
-
         vector_search = VectorSearch(
             vector=self._query_vector,
             limit=self._limit,
             field_name=self._vector_column.name
         )
-
-        try:
+        with _create_vector_reader(
+            index_type, file_io, index_path,
+            index_io_meta_list, options
+        ) as reader:
             offset_reader = OffsetGlobalIndexReader(reader, row_range_start, 
row_range_end)
             return offset_reader.visit_vector_search(vector_search)
-        finally:
-            reader.close()
 
 
 def _create_vector_reader(index_type, file_io, index_path, index_io_meta_list, 
options=None):

Reply via email to