feiniaofeiafei opened a new pull request, #67799:
URL: https://github.com/apache/doris/pull/67799
### What problem does this PR solve?
Problem Summary:
Creating a view with `SELECT * REPLACE(a + 1 AS a) FROM t` must preserve the
replacement expression in the stored view definition. Previously, star
expansion rendered only slots and overlapping SQL rewrite ranges could corrupt
the definition.
Render the final bound projections for star expansion, process enclosing
rewrite ranges before their contained ranges, and reject partially overlapping
ranges. Add a view SQL rendering mode that preserves qualified identifiers,
escaped aliases and strings, typed literals, and nested expression syntax
without reusing the default SQL cache. Unsupported subquery expressions fail
explicitly instead of being persisted as diagnostic text.
Also correct default SQL rendering for boolean predicates, aliases,
ordering, window frame boundaries, ordered aggregate arguments, and bound
lambdas. Share rendering logic between default and view modes where their SQL
syntax is the same.
### Release note
Fix creation of views containing star replacement expressions and preserve
their projected expressions in the stored SQL definition.
### Check List (For Author)
- Test:
- [x] Unit Test: `bash run-fe-ut.sh --run
org.apache.doris.nereids.trees.expressions.DefaultSqlRenderingTest,org.apache.doris.nereids.trees.expressions.ViewSqlRenderingTest,org.apache.doris.nereids.trees.expressions.ExpressionShapeInfoTest`
— 16 tests passed on the final source.
- [x] Regression test: `test_create_view_star_replace`,
`test_alter_view_nereids`, and `test_create_view_variant_nested_field` passed
during the earlier deployment validation, before the two subsequent
default-rendering cleanup commits. The new golden output was generated with the
regression runner and rerun successfully.
- [x] Manual test: the original constant replacement view returned `(99,
2)` during that deployment validation.
- Checkstyle passed with a separate `checkstyle:check -pl fe-core
-Dcheckstyle.skip=false` run.
- Behavior changed:
- [x] Yes. Persist the actual star replacement expressions and generate
valid default SQL for the affected expressions.
- Does this need documentation?
- [x] No. This corrects existing syntax and SQL rendering.
### 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]