Skip to content

[core] Support BLOB fields in partial-update tables. - #8928

Open
Stephen0421 wants to merge 1 commit into
apache:masterfrom
Stephen0421:blob-descriptor-partial-update
Open

[core] Support BLOB fields in partial-update tables.#8928
Stephen0421 wants to merge 1 commit into
apache:masterfrom
Stephen0421:blob-descriptor-partial-update

Conversation

@Stephen0421

@Stephen0421 Stephen0421 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Purpose

This PR adds BLOB support for primary-key tables using the partial-update merge engine.

The main changes include:

  • Support scalar blob-descriptor-field with partial updates.
  • Support managed blob-field for BLOB, ARRAY<BLOB>, and MAP<K, BLOB>.
  • Support scalar blob-view-field resolution and unresolved-reference forwarding.
  • Preserve managed BLOB pack dependencies before and after compaction.
  • Keep BLOB view prescan consistent with filtering, limits, authorization, and reader configuration.
  • Restore global limit behavior across multiple splits.
  • Document partial-update, collection, compaction, sidecar, and orphan-pack semantics.

Tests

  • SchemaValidationTest
  • PartialUpdateMergeFunctionTest
  • PrimaryKeyBlobFileWriterTest
  • PrimaryKeyPartialUpdateBlobTest
  • BlobViewTableReadSupportTest
  • PrimaryKeySimpleTableTest#testReadWithLimitThroughTableReadPathMultiSplit
  • PrimaryKeySimpleTableTest#testReadWithLimitThroughTableReadPathMultiSplitWithQueryAuthFilter
  • PartialUpdateITCase#testBlobDescriptorPartialUpdate
  • PartialUpdateITCase#testBlobDescriptorPartialUpdateSequenceGroup
  • PartialUpdateITCase#testManagedBlobPartialUpdate
  • PartialUpdateITCase#testManagedBlobPartialUpdateSequenceGroup
  • PartialUpdateITCase#testBlobViewPartialUpdate
  • PartialUpdateITCase#testBlobViewPartialUpdateForwardReference
  • PartialUpdateITCase#testBlobViewPartialUpdateSequenceGroup

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why reject managed BLOB and BLOB view fields for partial-update tables?

@Stephen0421 Stephen0421 changed the title [core] Support BLOB descriptors in partial-update tables. [core] Support BLOB fields in partial-update tables. Jul 31, 2026
@Stephen0421

Copy link
Copy Markdown
Contributor Author

Why reject managed BLOB and BLOB view fields for partial-update tables?
Actually it can support, already added.

@Stephen0421
Stephen0421 requested a review from JingsongLi August 3, 2026 03:35

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for two correctness issues in the newly enabled managed-BLOB partial-update path. The focused core tests and current CI pass, but neither case below is covered.


checkArgument(
options.mergeEngine() == MergeEngine.DEDUPLICATE
|| options.mergeEngine() == MergeEngine.PARTIAL_UPDATE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing PARTIAL_UPDATE here exposes an incompatible retract path for managed BLOBs. PrimaryKeyBlobExternalizer.externalize replaces every non-null managed BLOB with null for DELETE/UPDATE_BEFORE, while PartialUpdateMergeFunction passes that field to FieldAggregator.retract. With fields.ts.sequence-group=payload and fields.payload.aggregate-function=last_non_null_value, inserting (payload=A, ts=1) and then retracting (payload=A, ts=2) incorrectly keeps A, because a null retract field means ‘keep the accumulator.’ Please either preserve/externalize non-null managed BLOB values on retract (and retain their references), or reject retract-sensitive aggregation for managed BLOB fields. An end-to-end retract regression test would also be needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I fixed it at the schema-validation boundary.

For a managed BLOB field protected by a sequence group, retract-sensitive aggregate functions are now rejected because managed BLOB payloads are not retained in retract records. last_value remains supported because it can deterministically clear the field without the original payload, and other aggregate functions can be used with fields.<field>.ignore-retract=true.

The validation still allows safe cases such as ignore-delete=true and managed BLOB fields that are not protected by a sequence group.

I also added end-to-end coverage for newer and older retract sequences, compaction, empty compacted .blobref files, and ignore-retract with scalar, ARRAY, and MAP managed BLOB fields.

return;
}

Set<String> managedBlobFields =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation only checks the global sequence.field; it misses sequence-group ordering fields encoded in option keys. For example, fields.payload.sequence-group=name is accepted when payload is a managed BLOB in a partial-update table. PartialUpdateMergeFunction.Factory later creates a comparator for payload, and code generation fails with IllegalArgumentException: Illegal type: BLOB. Please parse the key portion of every fields.<key[,key...]>.sequence-group option and reject managed BLOB, ARRAY<BLOB>, and MAP<K, BLOB> fields there, while continuing to allow BLOBs on the protected-value side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed. Schema validation now parses the key portion of every partial-update fields.<key[,key...]>.sequence-group option and recursively rejects ordering fields containing BLOB, including ARRAY<BLOB> and MAP<K, BLOB>.

BLOB fields on the protected-value side remain supported. The parser is shared with PartialUpdateMergeFunction.Factory to keep schema validation and runtime behavior consistent.

I also added tests for scalar, ARRAY, MAP, multi-key ordering fields, allowed BLOB protected fields, malformed sequence-group options, and compatibility with non-partial-update merge engines.

@Stephen0421
Stephen0421 force-pushed the blob-descriptor-partial-update branch from 5a5726f to 3f18792 Compare August 3, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants