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 125df137e6 [Python] Fix scanner state assertions in planning tests
125df137e6 is described below
commit 125df137e6dcfc34f2749543dccb98b898be0660
Author: JingsongLi <[email protected]>
AuthorDate: Sat Oct 24 13:26:42 2026 +0800
[Python] Fix scanner state assertions in planning tests
---
paimon-python/pypaimon/tests/global_index_test.py | 13 +++++++------
paimon-python/pypaimon/tests/query_auth_filter_test.py | 14 +++++++++-----
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/paimon-python/pypaimon/tests/global_index_test.py
b/paimon-python/pypaimon/tests/global_index_test.py
index 38ebbd6fa6..ec889da3bf 100644
--- a/paimon-python/pypaimon/tests/global_index_test.py
+++ b/paimon-python/pypaimon/tests/global_index_test.py
@@ -23,7 +23,6 @@ import pyarrow as pa
import pytest
from pypaimon import CatalogFactory, Schema
-from pypaimon.execution.python.read.table_scan import PythonTableScan
from pypaimon.common.options.core_options import CoreOptions,
GlobalIndexSearchMode
from pypaimon.common.options.options import Options
from pypaimon.common.predicate import Predicate
@@ -33,6 +32,7 @@ from
pypaimon.execution.python.globalindex.global_index_evaluator import GlobalI
from pypaimon.globalindex.global_index_result import GlobalIndexResult
from pypaimon.index.index_file_meta import IndexFileMeta
from pypaimon.index.index_file_handler import IndexFileHandler
+from pypaimon.read.read_dispatch import _python_scan_execution
from pypaimon.schema.data_types import AtomicType, DataField
from pypaimon.snapshot.snapshot_manager import SnapshotManager
from pypaimon.tests.data_evolution_test_helpers import (
@@ -280,17 +280,18 @@ class GlobalIndexScalarFallbackTest(unittest.TestCase):
)
baseline_scan = read_builder.new_scan()
-
PythonTableScan(baseline_scan)._file_scanner()._global_index_result = index_plan
- PythonTableScan(baseline_scan)._file_scanner().predicate_for_stats
= None
+ baseline_scanner =
_python_scan_execution(baseline_scan)._file_scanner()
+ baseline_scanner._global_index_result = index_plan
+ baseline_scanner.predicate_for_stats = None
baseline_plan = baseline_scan.plan()
scan = read_builder.new_scan()
- PythonTableScan(scan)._file_scanner()._global_index_result =
index_plan
+ _python_scan_execution(scan)._file_scanner()._global_index_result
= index_plan
plan = scan.plan()
stats_scan = read_builder.new_scan()
- PythonTableScan(stats_scan)._file_scanner()._global_index_result =
index_plan
- stats_plan, stats =
PythonTableScan(stats_scan)._file_scanner().scan_with_stats()
+
_python_scan_execution(stats_scan)._file_scanner()._global_index_result =
index_plan
+ stats_plan, stats = stats_scan.scan_with_stats()
self.assertEqual(
10,
diff --git a/paimon-python/pypaimon/tests/query_auth_filter_test.py
b/paimon-python/pypaimon/tests/query_auth_filter_test.py
index ab2e3bb775..e24d5eb482 100644
--- a/paimon-python/pypaimon/tests/query_auth_filter_test.py
+++ b/paimon-python/pypaimon/tests/query_auth_filter_test.py
@@ -22,7 +22,6 @@ import pyarrow as pa
import pytest
from pypaimon import CatalogFactory, Schema
-from pypaimon.execution.python.read.table_scan import PythonTableScan
from pypaimon.execution.python.read.table_read import PythonTableRead
from pypaimon.catalog.table_query_auth import TableQueryAuthResult
from pypaimon.common.predicate_builder import PredicateBuilder
@@ -263,8 +262,9 @@ def test_unmasked_conjunct_keeps_its_pushdown(table):
predicate = PredicateBuilder.and_predicates([unmasked,
predicates.is_null('secret')])
scan = table.new_read_builder().with_filter(predicate).new_scan()
scan.plan()
- assert PythonTableScan(scan)._file_scanner().predicate == unmasked
- assert PythonTableScan(scan)._file_scanner().auth_has_non_partition_filter
+ scanner = scan._execution._file_scanner()
+ assert scanner.predicate == unmasked
+ assert scanner.auth_has_non_partition_filter
def test_same_scan_refreshes_masked_filter_rules(table):
@@ -351,10 +351,14 @@ def
test_write_scan_restores_filter_after_rules_are_removed(table):
builder = table.new_read_builder().with_filter(predicate)
scan = builder.new_scan()
scan.plan()
+ scanner = scan._execution._file_scanner()
+ assert scanner.predicate is None
+ assert scanner.auth_has_non_partition_filter
state[0] = None
splits = scan.plan_all().splits()
- assert PythonTableScan(scan)._file_scanner().predicate == predicate
- assert not
PythonTableScan(scan)._file_scanner().auth_has_non_partition_filter
+ scanner = scan._execution._file_scanner()
+ assert scanner.predicate == predicate
+ assert not scanner.auth_has_non_partition_filter
assert arrow_rows(builder.new_read().to_arrow(splits)) == []