JingsongLi commented on code in PR #11163:
URL: https://github.com/apache/paimon/pull/11163#discussion_r4600809121


##########
paimon-python/pypaimon/write/backend_dispatch.py:
##########
@@ -97,6 +97,11 @@ def _prepare_write(table, commit_user, static_partition, 
stream,
     from pypaimon.read.merge_engine_support import 
check_sequence_field_supported
     check_sequence_field_supported(table)
     if table.options.native_write_enabled():
+        from pypaimon.common.native_compatibility import 
require_native_compatible
+        # nested-sequence-overwrite-on-equal=false must not enter Native write.
+        if require_native_compatible(table.options, 
allow_python_fallback=True) is not None:

Review Comment:
   [P2] Support ROW-valued sequences in the forced Python path
   
   The new blanket fallback also routes valid ROW-valued nested sequences into 
a comparator that cannot order them. With `updates ARRAY<ROW<key BIGINT,value 
STRING,seq ROW<part BIGINT>>>`, nested-key=key, nested-sequence-field=seq and 
overwrite-on-equal=false, writing two same-key rows with seq={part:7} now fails 
at `prepare_commit`: `_compare_objects` evaluates `dict > dict` and raises 
TypeError. The identical Native0.5.0 true-policy control succeeds, as does the 
unchanged merge-base route; Java false-policy 
write/commit/full-compaction/reopen retains the first value successfully. The 
Python scalar/multi-field tests do not cover this supported sequence type. 
Please make the Python comparison schema-aware/recursive (or reject unsupported 
schemas before staging a write) before forcing this route, with a real 
ROW-sequence regression.



##########
paimon-python/pypaimon/write/backend_dispatch.py:
##########
@@ -254,6 +259,9 @@ def prepare():
 def prepare_native_write_operation(operation, table, commit_user, *args, 
**kwargs):
     if not table.options.native_write_enabled():
         return None
+    from pypaimon.common.native_compatibility import require_native_compatible
+    if require_native_compatible(table.options, allow_python_fallback=True) is 
not None:

Review Comment:
   [P1] Apply this policy check to native MERGE table sources
   
   `prepare_native_merge_into` is a separate path and does not pass through 
this new gate. It converts a PK table source directly into a Native table, so 
the guarded public reader never runs. I reproduced this with an aggregation 
source using `nested_update`, overwrite-on-equal=false, and two separately 
committed Parquet versions `(key=1, seq=7, value=first/second)`. The public 
source read retains `first`; Native MERGE into a Data Evolution target persists 
`first` when given that materialized Arrow source, but `second` when given the 
source table object. Python MERGE execution was forbidden in both cases. The 
true-policy control and the exact merge-base control agree across both input 
forms. Please validate the source table's effective policy before creating the 
Native source and select the existing Python MERGE fallback when incompatible; 
cover this with a real table-source integration case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to