zhuanshenbsj1 commented on code in PR #10655:
URL: https://github.com/apache/paimon/pull/10655#discussion_r4313926531


##########
paimon-python/pypaimon/schema/schema_manager.py:
##########
@@ -437,35 +437,125 @@ def _validate_blob_fields(
             )
         )
 
+    if video_fields and primary_keys:
+        raise ValueError(
+            f"'{CoreOptions.VIDEO_FRAME_FIELD.key()}' only supports 
append-only tables."
+        )
+
     if blob_field_names:
-        required_options = {
-            CoreOptions.ROW_TRACKING_ENABLED.key(): 'true',
-            CoreOptions.DATA_EVOLUTION_ENABLED.key(): 'true'
-        }
+        if blob_field_names.intersection(partition_keys):
+            raise ValueError(
+                "The BLOB, ARRAY<BLOB> or MAP<X, BLOB> type column can not be "
+                "part of partition keys."
+            )
 
-        missing_options = []
-        for key, expected_value in required_options.items():
-            if key not in options or options[key] != expected_value:
-                missing_options.append(f"{key}='{expected_value}'")
+        if not primary_keys:
+            required_options = {
+                CoreOptions.ROW_TRACKING_ENABLED.key(): 'true',
+                CoreOptions.DATA_EVOLUTION_ENABLED.key(): 'true'
+            }
+
+            missing_options = []
+            for key, expected_value in required_options.items():
+                if key not in options or options[key] != expected_value:
+                    missing_options.append(f"{key}='{expected_value}'")
+
+            if missing_options:
+                raise ValueError(
+                    f"Schema contains BLOB, ARRAY<BLOB> or MAP<X, BLOB> type 
but is "
+                    f"missing required options: "
+                    f"{', '.join(missing_options)}. "
+                    f"Please add these options to the schema."
+                )
+        else:
+            _validate_primary_key_blob_fields(

Review Comment:
   Thanks for the review and catching this!
   I have updated the PR to mirror both Java guards:
   
       1. Partial-update managed BLOB retract aggregation**: Added validation 
to reject managed BLOB fields protected by sequence groups when using 
non-`last_value` aggregations, unless `fields.<field>.ignore-retract` or 
`ignore-delete` is true (mirroring Java `validatePrimaryKeyBlobConfiguration`).
       2. Sequence-group ordering fields**: Added 
`_validate_sequence_group_ordering_fields` to reject BLOB columns used as 
sequence-group ordering keys (mirroring Java 
`validateSequenceGroupOrderingFields`).
       3. Sequence-group primary-key restriction**: Added check ensuring 
primary key columns are not used as sequence-group ordering or protected fields 
(mirroring Java `PartialUpdateMergeFunction#SEQUENCE_GROUP_PK_ERROR`).
   
   Added corresponding rejection tests and valid exception tests in 
`schema_manager_test.py`. PTAL @JingsongLi, thanks!



-- 
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