Skip to content

branch-4.2: [fix](cloud) Preserve VARIANT escape policy presence in protobuf conversions - #70755

Open
eldenmoon wants to merge 1 commit into
apache:branch-4.2from
eldenmoon:branch-pick-70622-4.2-20261119
Open

eldenmoon wants to merge 1 commit into
apache:branch-4.2from
eldenmoon:branch-pick-70622-4.2-20261119

Conversation

@eldenmoon

Copy link
Copy Markdown
Member

cherry-pick #70622

Conflicts in be/src/cloud/pb_convert.cpp were resolved by guarding the existing branch-4.2 setters with has_variant_escape_dots_in_keys() and not bringing in unrelated master-only fields.

…ersions (apache#70622)

Doris converts tablet schemas between `TabletSchemaPB` and
`TabletSchemaCloudPB` when exchanging cloud metadata. The optional
`variant_escape_dots_in_keys` field defaults to `false`, while protobuf
separately tracks whether it was explicitly set.

Issue Number: None
Related PR: apache#69995 (introduced the field)
PR Type: Bugfix

Problem Summary:

Converting a schema without `variant_escape_dots_in_keys` currently
turns the absent field into an explicitly set `false`. Check
`has_variant_escape_dots_in_keys()` before setting it in both conversion
directions and both copy/move implementations, as requested in Gavin's
review of apache#69995. Explicit `false` and `true` values remain present and
unchanged; the default value remains `false`.

- **Frequency:** Every conversion of a source schema that omits the
field.
- **Root cause:** Unconditional protobuf setters materialize the default
value and set the presence bit.
- **Why existing tests missed it:** The policy round-trip test checked
values only, so absence and explicit `false` were indistinguishable. The
all-fields tests explicitly populate every field.
- **Fix:** Guard the four setters with the matching protobuf presence
check. Add absent-field coverage and strengthen explicit-value round
trips with presence assertions.
- **Other paths and branches:** Both cloud/local directions and
const-reference/rvalue overloads are covered; the value-returning
wrappers delegate to them. This PR targets master.
- **Behavior change:** An omitted optional field remains omitted after
conversion; explicit values and effective defaults are unchanged.

- On dev-x, the new `PBConvertTest.VariantEscapeTablePolicyAbsent` fails
before the fix: presence becomes `true` in all four conversion paths for
absent input fields.
- After the fix, ASAN `./run-be-ut.sh --run
--filter="PbConvert.*:PBConvertTest.*:TabletSchemaTest.*"` passes all 42
tests across three suites. This host's UT invocation uses
`GLIBC_COMPATIBILITY=OFF` to avoid duplicate compatibility symbols with
its LDB toolchain; this is a test-only setting.
- clang-format 16, the format check, and changed-line clang-tidy all
pass.

None

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

- Tool: OpenAI Codex (GPT-6)
- Generated: Code, tests, and this description.
- Human review: Pending author review.

(cherry picked from commit 256e786)
@eldenmoon
eldenmoon requested a review from yiguolei as a code owner November 19, 2026 09:59
@eldenmoon

Copy link
Copy Markdown
Member Author

run buildall

@eldenmoon

Copy link
Copy Markdown
Member Author

run beut

1 similar comment
@eldenmoon

Copy link
Copy Markdown
Member Author

run beut

@eldenmoon

Copy link
Copy Markdown
Member Author

run nonConcurrent

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.

1 participant