@@ -235,6 +235,45 @@ def test_create_primary_key_blob_tables(self):
235235 AtomicType ("BLOB" ),
236236 {"blob-view-field" : "payload" , "changelog-producer" : "input" },
237237 ),
238+ (
239+ "partial_update_ignore_retract" ,
240+ AtomicType ("BLOB" ),
241+ {
242+ "merge-engine" : "partial-update" ,
243+ "fields.ts.sequence-group" : "payload" ,
244+ "fields.payload.aggregate-function" : "last_non_null_value" ,
245+ "fields.payload.ignore-retract" : "true" ,
246+ },
247+ ),
248+ (
249+ "partial_update_ignore_delete" ,
250+ AtomicType ("BLOB" ),
251+ {
252+ "merge-engine" : "partial-update" ,
253+ "fields.ts.sequence-group" : "payload" ,
254+ "fields.payload.aggregate-function" : "last_non_null_value" ,
255+ "partial-update.ignore-delete" : "true" ,
256+ },
257+ ),
258+ (
259+ "partial_update_last_value" ,
260+ AtomicType ("BLOB" ),
261+ {
262+ "merge-engine" : "partial-update" ,
263+ "fields.ts.sequence-group" : "payload" ,
264+ "fields.payload.aggregate-function" : "last_value" ,
265+ },
266+ ),
267+ (
268+ "partial_update_inline_blob_agg" ,
269+ AtomicType ("BLOB" ),
270+ {
271+ "merge-engine" : "partial-update" ,
272+ "blob-descriptor-field" : "payload" ,
273+ "fields.ts.sequence-group" : "payload" ,
274+ "fields.payload.aggregate-function" : "last_non_null_value" ,
275+ },
276+ ),
238277 ]
239278 for suffix , blob_type , extra_options in blob_types :
240279 with self .subTest (kind = suffix ):
@@ -245,14 +284,15 @@ def test_create_primary_key_blob_tables(self):
245284 schema = Schema (
246285 fields = [
247286 DataField (0 , "id" , AtomicType ("INT" , False )),
248- DataField (1 , "payload" , blob_type ),
287+ DataField (1 , "ts" , AtomicType ("INT" , False )),
288+ DataField (2 , "payload" , blob_type ),
249289 ],
250290 primary_keys = ["id" ],
251291 options = extra_options ,
252292 )
253293 table_schema = manager .create_table (schema )
254294 self .assertEqual (table_schema .primary_keys , ["id" ])
255- self .assertEqual (table_schema .fields [1 ].type , blob_type )
295+ self .assertEqual (table_schema .fields [2 ].type , blob_type )
256296
257297 def test_create_primary_key_blob_table_validation (self ):
258298 cases = [
@@ -370,6 +410,103 @@ def test_create_primary_key_blob_table_validation(self):
370410 {"pk-clustering-override" : "true" },
371411 "Primary-key managed BLOB tables do not support 'pk-clustering-override'." ,
372412 ),
413+ (
414+ "managed_blob_partial_update_retract_agg" ,
415+ [
416+ DataField (0 , "id" , AtomicType ("INT" , False )),
417+ DataField (1 , "ts" , AtomicType ("INT" , False )),
418+ DataField (2 , "payload" , AtomicType ("BLOB" )),
419+ ],
420+ ["id" ],
421+ {
422+ "merge-engine" : "partial-update" ,
423+ "fields.ts.sequence-group" : "payload" ,
424+ "fields.payload.aggregate-function" : "last_non_null_value" ,
425+ },
426+ r"Managed BLOB field 'payload' cannot use aggregate function 'last_non_null_value' "
427+ r"because managed BLOB payloads are not retained in retract messages\. "
428+ r"Set 'fields\.payload\.ignore-retract' to true to ignore retract messages\." ,
429+ ),
430+ (
431+ "managed_blob_partial_update_default_agg" ,
432+ [
433+ DataField (0 , "id" , AtomicType ("INT" , False )),
434+ DataField (1 , "ts" , AtomicType ("INT" , False )),
435+ DataField (2 , "payload" , AtomicType ("BLOB" )),
436+ ],
437+ ["id" ],
438+ {
439+ "merge-engine" : "partial-update" ,
440+ "fields.ts.sequence-group" : "payload" ,
441+ "fields.default-aggregate-function" : "last_non_null_value" ,
442+ },
443+ r"Managed BLOB field 'payload' cannot use aggregate function 'last_non_null_value' "
444+ r"because managed BLOB payloads are not retained in retract messages\. "
445+ r"Set 'fields\.payload\.ignore-retract' to true to ignore retract messages\." ,
446+ ),
447+ (
448+ "managed_blob_as_sequence_group_ordering_field" ,
449+ [
450+ DataField (0 , "id" , AtomicType ("INT" , False )),
451+ DataField (1 , "ts" , AtomicType ("INT" , False )),
452+ DataField (2 , "payload" , AtomicType ("BLOB" )),
453+ ],
454+ ["id" ],
455+ {
456+ "merge-engine" : "partial-update" ,
457+ "fields.payload.sequence-group" : "ts" ,
458+ },
459+ r"Field 'payload' with type BLOB cannot be used as a sequence-group ordering "
460+ r"field in option 'fields\.payload\.sequence-group'\." ,
461+ ),
462+ (
463+ "inline_blob_as_sequence_group_ordering_field" ,
464+ [
465+ DataField (0 , "id" , AtomicType ("INT" , False )),
466+ DataField (1 , "ts" , AtomicType ("INT" , False )),
467+ DataField (2 , "payload" , AtomicType ("BLOB" )),
468+ ],
469+ ["id" ],
470+ {
471+ "merge-engine" : "partial-update" ,
472+ "blob-descriptor-field" : "payload" ,
473+ "fields.payload.sequence-group" : "ts" ,
474+ },
475+ r"Field 'payload' with type BLOB cannot be used as a sequence-group ordering "
476+ r"field in option 'fields\.payload\.sequence-group'\." ,
477+ ),
478+ (
479+ "pk_as_sequence_group_ordering_field" ,
480+ [
481+ DataField (0 , "id" , AtomicType ("INT" , False )),
482+ DataField (1 , "ts" , AtomicType ("INT" , False )),
483+ DataField (2 , "payload" , AtomicType ("BLOB" )),
484+ ],
485+ ["id" ],
486+ {
487+ "merge-engine" : "partial-update" ,
488+ "fields.id.sequence-group" : "payload" ,
489+ },
490+ r"The sequence-group 'fields\.id\.sequence-group' contains primary key field "
491+ r"'id', which is not allowed\. Primary key columns cannot be put in "
492+ r"sequence-group\." ,
493+ ),
494+ (
495+ "pk_as_sequence_group_protected_field" ,
496+ [
497+ DataField (0 , "id" , AtomicType ("INT" , False )),
498+ DataField (1 , "ts" , AtomicType ("INT" , False )),
499+ DataField (2 , "payload" , AtomicType ("BLOB" )),
500+ ],
501+ ["id" ],
502+ {
503+ "merge-engine" : "partial-update" ,
504+ "fields.ts.sequence-group" : "id,payload" ,
505+ },
506+ r"The sequence-group 'fields\.ts\.sequence-group' contains primary key field "
507+ r"'id', which is not allowed\. Primary key columns cannot be put in "
508+ r"sequence-group\." ,
509+ ),
373510 ]
374511
375512 for name , fields , pks , opts , error_regex in cases :
0 commit comments