[fix](fe) Quote view column names in SHOW CREATE VIEW output - #66467
Open
englefly wants to merge 2 commits into
Open
[fix](fe) Quote view column names in SHOW CREATE VIEW output#66467englefly wants to merge 2 commits into
englefly wants to merge 2 commits into
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#55819 Problem Summary: When a view is created with a column name containing special characters (e.g. `create view v as select 1 as '(第一列)'` with enable_unicode_name_support enabled), SHOW CREATE VIEW emits an unquoted column definition list like `((第一列))` — the outer parens are the list, the inner `(第一列)` is the raw column name emitted without backtick quoting. The generated DDL is not re-executable: the CREATE VIEW column list grammar requires an identifier (DorisParser.g4 simpleColumnDef -> identifier), and an unquoted name with parens fails to parse (`mismatched input '第一列'`). The column list itself was introduced by apache#55819 to preserve explicit column definitions/comments in SHOW CREATE VIEW, but Env.addColNameAndComment (Env.java) emitted column names verbatim. Fix: quote every column name with SqlUtils.getIdentSql (backtick-quoting with embedded-backtick escaping) and escape single quotes in column comments. After the fix SHOW CREATE VIEW outputs `CREATE VIEW `v` (`(第一列)`) AS select 1 as `(第一列)`;` which is valid SQL and round-trips. ### Release note SHOW CREATE VIEW now quotes view column names in the column definition list, so the output stays re-executable even when column names contain special characters (e.g. created via string-literal aliases with enable_unicode_name_support). ### Check List (For Author) - Test: - FE compile: `mvn compile -pl fe-core -am` passed - Ad-hoc parser verification passed (fixed DDL parses, old unquoted DDL rejected) - Regression suite ddl_p0/create_view_nereids run and test_create_view_nereids.out regenerated with the fixed output; the other 7 affected .out files still need regeneration - Behavior changed: Yes (SHOW CREATE VIEW output format) - Does this need documentation: No
englefly
requested review from
CalvinKirs,
dataroaring and
morningman
as code owners
August 5, 2026 05:53
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
FE Regression Coverage ReportIncrement line coverage |
Contributor
TPC-H: Total hot run time: 29478 ms |
Contributor
TPC-DS: Total hot run time: 166744 ms |
Contributor
ClickBench: Total hot run time: 23.86 s |
…s in SHOW CREATE VIEW ### What problem does this PR solve? Issue Number: None Related PR: apache#55819 Problem Summary: The SHOW CREATE VIEW column-list quoting fix (SqlUtils.getIdentSql in Env.addColNameAndComment) changes the emitted DDL: every view column name in the column definition list is now backtick-quoted, e.g. (user_id,cost) becomes (`user_id`,`cost`). The 7 affected regression .out files are regenerated accordingly, and the hardcoded assertion in mtmv_p0/test_show_create_mtmv is updated to expect the quoted column list (`aa` comment 'aa_comment',`bb`). The replica-3 golden blocks in test_show_create_table_and_views_nereids.out are unchanged by this PR and are preserved. ### Release note None ### Check List (For Author) - Test: Regression test (all 8 listed suites run with -forceGenOut to regenerate, then re-run without the flag and verified passing) - Behavior changed: No (test-only changes) - Does this need documentation: No
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 29241 ms |
Contributor
TPC-DS: Total hot run time: 158818 ms |
Contributor
ClickBench: Total hot run time: 23.83 s |
Contributor
FE Regression Coverage ReportIncrement line coverage |
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: #55819
Problem Summary:
When a view is created with a column name containing special characters (e.g.
create view v as select 1 as '(第一列)'with enable_unicode_name_support enabled), SHOW CREATE VIEW emits an unquoted column definition list like((第一列))— the outer parens are the list, the inner(第一列)is the raw column name emitted without backtick quoting. The generated DDL is not re-executable: the CREATE VIEW column list grammar requires an identifier (DorisParser.g4 simpleColumnDef -> identifier), and an unquoted name with parens fails to parse (mismatched input '第一列').The column list itself was introduced by #55819 to preserve explicit column definitions/comments in SHOW CREATE VIEW, but Env.addColNameAndComment (Env.java) emitted column names verbatim.
Fix: quote every column name with SqlUtils.getIdentSql (backtick-quoting with embedded-backtick escaping) and escape single quotes in column comments. After the fix SHOW CREATE VIEW outputs
CREATE VIEWv((第一列)) AS select 1 as(第一列);which is valid SQL and round-trips.Release note
SHOW CREATE VIEW now quotes view column names in the column definition list, so the output stays re-executable even when column names contain special characters (e.g. created via string-literal aliases with enable_unicode_name_support).
Check List (For Author)
mvn compile -pl fe-core -ampassedWhat problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)