[fix](fe) Preserve SQL-rendering fields in Expr Gson serialization - #67159
Open
0AyanamiRei wants to merge 2 commits into
Open
[fix](fe) Preserve SQL-rendering fields in Expr Gson serialization#671590AyanamiRei wants to merge 2 commits into
0AyanamiRei wants to merge 2 commits into
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#62900 Problem Summary: Doris metadata Gson instances omit fields without @SerializedName. The existing Expr Gson test checked subtype restoration and JSON idempotence, but both checks can pass after a semantic field has already been dropped from the first JSON representation. Add stable serialized names for Expr state required to reconstruct canonical SQL, including function ORDER BY metadata and placeholder protocol state. Strengthen the shared Expr test so the source hierarchy, both Gson subtype registries, and the sample corpus remain aligned; every direct Expr field is serialized or explicitly classified as derived state; and every concrete sample preserves SQL with and without table names through both Gson instances. Add direct round-trip checks for nested ORDER BY elements and the placeholder MySQL type code. Analyzer, planner, and execution caches remain non-durable and must be rebuilt after SQL reconstruction and analysis. ### Release note None ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.analysis.ExprGsonSerializationTest - Behavior changed: No user-facing SQL syntax or interface changes. Newly written Expr JSON preserves the covered SQL-rendering state. - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
### What problem does this PR solve? Issue Number: None Related PR: apache#62900 Problem Summary: Expr metadata persistence relies on stable Gson field annotations and semantic round-trip coverage. Add a colocated review guide that makes the durable-field, subtype-registration, sample-quality, and metadata-consumer test requirements explicit for future Expr changes. ### Release note None ### Check List (For Author) - Test: No need to test; this commit only adds contributor review guidance. - Behavior changed: No. - Does this need documentation: No; this commit is the contributor guide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: None
Related PR: #62900
Problem Summary:
Doris metadata Gson instances use an exclusion strategy that omits fields without
@SerializedName.ExprGsonSerializationTestpreviously verified the restored concrete subtype and JSON idempotence. Those assertions can still pass after a field has already been omitted from the first serialized JSON, so they do not prove that an expression keeps the same canonical SQL.This PR adds stable serialized names for state used by SQL reconstruction in:
FunctionCallExprand its nestedOrderByElementMatchPredicatePlaceHolderExprSearchPredicateSlotRefTimeV2LiteralVariableExprIt also strengthens the shared Expr serialization contract:
ExprToSqlVisitoroutput with and without table names through bothGsonUtils.GSONandGsonUtilsCatalog.GSON;ORDER BYstate and placeholder MySQL protocol state are checked directly.A colocated
AGENTS.mdrecords these persistence and test requirements as a review checklist for future Expr and metadata-consumer changes.The durable contract is concrete subtype plus canonical SQL reconstruction. Analyzer, planner, translation, and execution caches remain intentionally non-durable and are rebuilt by later analysis. The newly added JSON fields are additive; metadata written before this change cannot recover values that were never serialized.
Release note
None
Check List (For Author)
Test
./run-fe-ut.sh --run org.apache.doris.analysis.ExprGsonSerializationTestBehavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)