[fix](variant) preserve subcolumns after row-store partial update - #62067
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
There was a problem hiding this comment.
Pull request overview
Adds a regression test and BE write-path changes to ensure VARIANT subcolumns are preserved/materialized correctly after row-store partial updates.
Changes:
- Add a regression scenario that updates a non-VARIANT column and verifies VARIANT subfields remain readable and unchanged.
- Materialize VARIANT columns after filling missing columns during partial-update writes (both SegmentWriter and VerticalSegmentWriter).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| regression-test/suites/variant_p0/delete_update.groovy | Adds a regression case for VARIANT subcolumn preservation across partial updates in row-store tables. |
| be/src/storage/segment/vertical_segment_writer.cpp | Materializes VARIANT columns in the partial-update append path before serializing to row-store. |
| be/src/storage/segment/segment_writer.cpp | Same VARIANT materialization step in the non-vertical segment writer partial-update append path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def wholeVariant = sql """select cast(event_property_variant as string) | ||
| from ${partialUpdateVariantTable} | ||
| where event_id = 1""" | ||
| assertEquals('{"base_id":"100000000009523363","other_key":"abc"}', wholeVariant[0][0]) |
There was a problem hiding this comment.
This assertion is potentially flaky because the string serialization of a VARIANT/JSON object may not guarantee key order or exact formatting. To make the test stable, assert on individual fields (e.g., base_id and other_key) or compare a canonicalized representation rather than strict string equality of the whole object.
| def wholeVariant = sql """select cast(event_property_variant as string) | |
| from ${partialUpdateVariantTable} | |
| where event_id = 1""" | |
| assertEquals('{"base_id":"100000000009523363","other_key":"abc"}', wholeVariant[0][0]) | |
| def wholeVariant = sql """select cast(event_property_variant['base_id'] as string), | |
| cast(event_property_variant['other_key'] as string) | |
| from ${partialUpdateVariantTable} | |
| where event_id = 1""" | |
| assertEquals("100000000009523363", wholeVariant[0][0]) | |
| assertEquals("abc", wholeVariant[0][1]) |
| from ${partialUpdateVariantTable} | ||
| where event_id = 1""" | ||
| assertEquals("100000000009523363", beforeUpdate[0][0]) | ||
|
|
There was a problem hiding this comment.
This test intends to validate behavior after a partial update, but it doesn't explicitly enable partial updates before running the UPDATE (the suite enables enable_unique_key_partial_update later for a different section). Consider setting enable_unique_key_partial_update=true (and syncing) before this UPDATE, so the regression reliably exercises the specific code path this PR changes.
| sql "set enable_unique_key_partial_update=true;" | |
| sql "sync" |
1f48122 to
cbbda43
Compare
|
run buildall |
TPC-H: Total hot run time: 29157 ms |
TPC-DS: Total hot run time: 180841 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
|
skip check_coverage |
|
PR approved by anyone and no changes requested. |
airborne12
left a comment
There was a problem hiding this comment.
LGTM. Critical bug fix — variant subcolumns were lost during row-store partial update because parse_and_materialize_variant_columns was not called after fill_missing_columns. Both segment_writer and vertical_segment_writer are consistently fixed. Regression test precisely covers the failure scenario.
|
PR approved by at least one committer and no changes requested. |
…2067) need to materialize variant after reading from row store when partial update
…2067) need to materialize variant after reading from row store when partial update
need to materialize variant after reading from row store when partial update