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

JingsongLi 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 e94c39ae1c [python] Fix latest snapshot lookup for index scan (#8771)
e94c39ae1c is described below

commit e94c39ae1cbcd3088315e46c9c418df24aee1cd3
Author: Kerwin Zhang <[email protected]>
AuthorDate: Tue Jul 21 15:40:52 2026 +0800

    [python] Fix latest snapshot lookup for index scan (#8771)
---
 paimon-python/pypaimon/index/index_file_handler.py |  2 +-
 .../pypaimon/tests/index_file_handler_test.py      | 37 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/paimon-python/pypaimon/index/index_file_handler.py 
b/paimon-python/pypaimon/index/index_file_handler.py
index 7cd72ce815..f1e1938824 100644
--- a/paimon-python/pypaimon/index/index_file_handler.py
+++ b/paimon-python/pypaimon/index/index_file_handler.py
@@ -46,7 +46,7 @@ class IndexFileHandler:
         entry_filter: Optional[Callable[['IndexManifestEntry'], bool]] = None
     ) -> List['IndexManifestEntry']:
         if snapshot is None:
-            snapshot = self._snapshot_manager.latest_snapshot()
+            snapshot = self._snapshot_manager.get_latest_snapshot()
 
         if snapshot is None:
             return []
diff --git a/paimon-python/pypaimon/tests/index_file_handler_test.py 
b/paimon-python/pypaimon/tests/index_file_handler_test.py
new file mode 100644
index 0000000000..38056b8c84
--- /dev/null
+++ b/paimon-python/pypaimon/tests/index_file_handler_test.py
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from unittest.mock import Mock
+
+from pypaimon.index.index_file_handler import IndexFileHandler
+
+
+class IndexFileHandlerTest(unittest.TestCase):
+
+    def test_scan_resolves_unspecified_snapshot(self):
+        snapshot_manager = Mock(spec=['get_latest_snapshot'])
+        snapshot_manager.get_latest_snapshot.return_value = None
+        table = Mock()
+        table.snapshot_manager.return_value = snapshot_manager
+
+        self.assertEqual([], IndexFileHandler(table).scan(None))
+        snapshot_manager.get_latest_snapshot.assert_called_once_with()
+
+
+if __name__ == '__main__':
+    unittest.main()

Reply via email to