0AyanamiRei opened a new pull request, #67159:
URL: https://github.com/apache/doris/pull/67159
### 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`.
`ExprGsonSerializationTest` previously 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:
- `FunctionCallExpr` and its nested `OrderByElement`
- `MatchPredicate`
- `PlaceHolderExpr`
- `SearchPredicate`
- `SlotRef`
- `TimeV2Literal`
- `VariableExpr`
It also strengthens the shared Expr serialization contract:
- the source Expr hierarchy, both Gson subtype registries, and the sample
corpus must cover the same concrete subtypes;
- every direct Expr instance field must be serialized or explicitly
classified as derived, non-durable state;
- every concrete sample must preserve `ExprToSqlVisitor` output with and
without table names through both `GsonUtils.GSON` and `GsonUtilsCatalog.GSON`;
- non-default nested function `ORDER BY` state and placeholder MySQL
protocol state are checked directly.
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
- [ ] Regression test
- [x] Unit Test
- `./run-fe-ut.sh --run
org.apache.doris.analysis.ExprGsonSerializationTest`
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
- Behavior changed:
- [x] No. User-facing SQL syntax and interfaces are unchanged; newly
written Expr JSON preserves the covered SQL-rendering state.
- [ ] Yes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]