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 0f2ef900f7 [python] Fix writer test contracts across execution 
backends (#10789)
0f2ef900f7 is described below

commit 0f2ef900f74ab587cf06134a771ebab5bc13cb26
Author: QuakeWang <[email protected]>
AuthorDate: Sat Oct 24 12:51:54 2026 +0800

    [python] Fix writer test contracts across execution backends (#10789)
---
 paimon-python/pypaimon/tests/execution_dispatch_test.py |  4 +++-
 paimon-python/pypaimon/tests/rest/rest_simple_test.py   | 12 ++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/paimon-python/pypaimon/tests/execution_dispatch_test.py 
b/paimon-python/pypaimon/tests/execution_dispatch_test.py
index a6e4a9eaa0..012e88b9ff 100644
--- a/paimon-python/pypaimon/tests/execution_dispatch_test.py
+++ b/paimon-python/pypaimon/tests/execution_dispatch_test.py
@@ -58,8 +58,9 @@ def test_fork_error_is_never_retried_by_python():
 
 def test_native_write_error_cannot_trigger_python_replay():
     failure = OSError('write may already have created a file')
-    native = SimpleNamespace(stream=False, 
write_arrow_batch=Mock(side_effect=failure))
     table = 
SimpleNamespace(options=SimpleNamespace(native_write_enabled=lambda: True))
+    native = SimpleNamespace(table=table, commit_user='writer', 
static_partition=None,
+                             stream=False, 
write_arrow_batch=Mock(side_effect=failure))
     with 
patch('pypaimon.read.merge_engine_support.check_sequence_field_supported'), \
             
patch('pypaimon.execution.native.write.native_write.create_native_write', 
return_value=native), \
             patch.object(dispatch, 'create_python_write') as python_write:
@@ -67,6 +68,7 @@ def test_native_write_error_cannot_trigger_python_replay():
         with pytest.raises(OSError) as caught:
             writer.write_arrow_batch('batch')
         assert caught.value is failure
+        native.write_arrow_batch.assert_called_once_with('batch', None)
         python_write.assert_not_called()
 
 
diff --git a/paimon-python/pypaimon/tests/rest/rest_simple_test.py 
b/paimon-python/pypaimon/tests/rest/rest_simple_test.py
index b61e04aba6..70cf78ae55 100644
--- a/paimon-python/pypaimon/tests/rest/rest_simple_test.py
+++ b/paimon-python/pypaimon/tests/rest/rest_simple_test.py
@@ -26,12 +26,8 @@ from pypaimon.catalog.catalog_exception import 
DatabaseAlreadyExistException, Ta
     DatabaseNotExistException, TableNotExistException
 from pypaimon.schema.data_types import AtomicType, DataField
 from pypaimon.schema.schema_change import SchemaChange
+from pypaimon.table.bucket_mode import BucketMode
 from pypaimon.tests.rest.rest_base_test import RESTBaseTest
-from pypaimon.execution.python.write.row_key_extractor import (
-    FixedBucketRowKeyExtractor,
-    DynamicBucketRowKeyExtractor,
-    UnawareBucketRowKeyExtractor,
-)
 
 if sys.version_info[:2] == (3, 6):
     from pypaimon.tests.py36.pyarrow_compat import table_sort_by
@@ -136,7 +132,7 @@ class RESTSimpleTest(RESTBaseTest):
 
         # Write data with single partition
         table_write = write_builder.new_write()
-        self.assertIsInstance(table_write._execution.row_key_extractor, 
UnawareBucketRowKeyExtractor)
+        self.assertEqual(table.bucket_mode(), BucketMode.BUCKET_UNAWARE)
 
         table_commit = write_builder.new_commit()
         data = {
@@ -616,7 +612,7 @@ class RESTSimpleTest(RESTBaseTest):
         write_builder = table.new_batch_write_builder()
         table_write = write_builder.new_write()
         table_commit = write_builder.new_commit()
-        self.assertIsInstance(table_write._execution.row_key_extractor, 
DynamicBucketRowKeyExtractor)
+        self.assertEqual(table.bucket_mode(), BucketMode.HASH_DYNAMIC)
 
         pa_table = pa.Table.from_pydict(self.data, schema=table_pa_schema)
         table_write.write_arrow(pa_table)
@@ -646,7 +642,7 @@ class RESTSimpleTest(RESTBaseTest):
         write_builder = table.new_batch_write_builder()
         table_write = write_builder.new_write()
         table_commit = write_builder.new_commit()
-        self.assertIsInstance(table_write._execution.row_key_extractor, 
FixedBucketRowKeyExtractor)
+        self.assertEqual(table.bucket_mode(), BucketMode.HASH_FIXED)
 
         pa_table = pa.Table.from_pydict(self.data, schema=table_pa_schema)
         table_write.write_arrow(pa_table)

Reply via email to