Skip to content

Commit 8b569c0

Browse files
committed
modify python
1 parent 0af14aa commit 8b569c0

File tree

10 files changed

+185
-505
lines changed

10 files changed

+185
-505
lines changed

paimon-python/pypaimon/globalindex/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
)
2727
from pypaimon.globalindex.global_index_meta import GlobalIndexMeta, GlobalIndexIOMeta
2828
from pypaimon.globalindex.global_index_evaluator import GlobalIndexEvaluator
29-
from pypaimon.globalindex.global_index_scan_builder import (
30-
GlobalIndexScanBuilder,
31-
RowRangeGlobalIndexScanner,
32-
)
29+
from pypaimon.globalindex.global_index_scanner import GlobalIndexScanner
3330
from pypaimon.utils.range import Range
3431

3532
__all__ = [
@@ -43,7 +40,6 @@
4340
'GlobalIndexMeta',
4441
'GlobalIndexIOMeta',
4542
'GlobalIndexEvaluator',
46-
'GlobalIndexScanBuilder',
47-
'RowRangeGlobalIndexScanner',
43+
'GlobalIndexScanner',
4844
'Range',
4945
]

paimon-python/pypaimon/globalindex/global_index_evaluator.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from pypaimon.globalindex.global_index_reader import GlobalIndexReader, FieldRef
2424
from pypaimon.globalindex.global_index_result import GlobalIndexResult
2525
from pypaimon.common.predicate import Predicate
26-
from pypaimon.globalindex.vector_search import VectorSearch
2726
from pypaimon.schema.data_types import DataField
2827

2928

@@ -44,45 +43,14 @@ def __init__(
4443

4544
def evaluate(
4645
self,
47-
predicate: Optional[Predicate],
48-
vector_search: Optional[VectorSearch]
46+
predicate: Optional[Predicate]
4947
) -> Optional[GlobalIndexResult]:
5048
compound_result: Optional[GlobalIndexResult] = None
5149

5250
# Evaluate predicate first
5351
if predicate is not None:
5452
compound_result = self._visit_predicate(predicate)
5553

56-
# Evaluate vector search
57-
if vector_search is not None:
58-
field = self._field_by_name.get(vector_search.field_name)
59-
if field is None:
60-
raise ValueError(f"Field not found: {vector_search.field_name}")
61-
62-
field_id = field.id
63-
readers = self._index_readers_cache.get(field_id)
64-
if readers is None:
65-
readers = self._readers_function(field)
66-
self._index_readers_cache[field_id] = readers
67-
68-
# If we have a compound result from predicates, use it to filter vector search
69-
if compound_result is not None:
70-
vector_search = vector_search.with_include_row_ids(compound_result.results())
71-
72-
for reader in readers:
73-
child_result = vector_search.visit(reader)
74-
if child_result is None:
75-
continue
76-
77-
# AND operation
78-
if compound_result is not None:
79-
compound_result = compound_result.and_(child_result)
80-
else:
81-
compound_result = child_result
82-
83-
if compound_result.is_empty():
84-
return compound_result
85-
8654
return compound_result
8755

8856
def _visit_predicate(self, predicate: Predicate) -> Optional[GlobalIndexResult]:
@@ -141,7 +109,7 @@ def _visit_leaf_predicate(self, predicate: Predicate) -> Optional[GlobalIndexRes
141109
continue
142110

143111
if compound_result is not None:
144-
compound_result = compound_result.and_(child_result)
112+
compound_result = compound_result.or_(child_result)
145113
else:
146114
compound_result = child_result
147115

paimon-python/pypaimon/globalindex/global_index_reader.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
"""Global index reader interface."""
2020

2121
from abc import ABC, abstractmethod
22-
from typing import List, Optional, TYPE_CHECKING
23-
24-
if TYPE_CHECKING:
25-
from pypaimon.globalindex.global_index_result import GlobalIndexResult
26-
from pypaimon.globalindex.vector_search import VectorSearch
22+
from typing import List, Optional
2723

2824

2925
class FieldRef:

paimon-python/pypaimon/globalindex/global_index_scan_builder.py

Lines changed: 0 additions & 202 deletions
This file was deleted.

0 commit comments

Comments
 (0)