Skip to content

Commit c09d811

Browse files
committed
fix
1 parent 7555189 commit c09d811

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

paimon-python/pypaimon/write/file_store_write.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from pypaimon.write.writer.append_only_data_writer import AppendOnlyDataWriter
2424
from pypaimon.write.writer.data_writer import DataWriter
2525
from pypaimon.write.writer.key_value_data_writer import KeyValueDataWriter
26+
from pypaimon.read.table_scan import TableScan
2627

2728

2829
class FileStoreWrite:
@@ -33,7 +34,7 @@ def __init__(self, table):
3334

3435
self.table: FileStoreTable = table
3536
self.data_writers: Dict[Tuple, DataWriter] = {}
36-
self.max_seq_numbers = None
37+
self.max_seq_numbers: dict = {}
3738
self.write_cols = None
3839

3940
def write(self, partition: Tuple, bucket: int, data: pa.RecordBatch):
@@ -79,16 +80,24 @@ def close(self):
7980
writer.close()
8081
self.data_writers.clear()
8182

82-
def _seq_number_stats(self) -> dict:
83-
if self.max_seq_numbers is None:
84-
self.max_seq_numbers = self._load_seq_number_stats()
85-
return self.max_seq_numbers
83+
def _seq_number_stats(self, partition: Tuple) -> dict[int, int]:
84+
buckets = self.max_seq_numbers.get(partition)
85+
if buckets is None:
86+
buckets = self._load_seq_number_stats(partition)
87+
self.max_seq_numbers[partition] = buckets
88+
return buckets
8689

87-
def _load_seq_number_stats(self) -> dict:
90+
def _load_seq_number_stats(self, partition: Tuple) -> dict:
8891
from pypaimon.manifest.manifest_file_manager import ManifestFileManager
8992
from pypaimon.manifest.manifest_list_manager import ManifestListManager
9093
from pypaimon.snapshot.snapshot_manager import SnapshotManager
9194

95+
self.table.new_read_builder()
96+
scan = TableScan(
97+
table=self.table,
98+
predicate=self._predicate
99+
)
100+
92101
snapshot_manager = SnapshotManager(self.table)
93102
manifest_list_manager = ManifestListManager(self.table)
94103
manifest_file_manager = ManifestFileManager(self.table)

0 commit comments

Comments
 (0)