924060929 opened a new pull request, #70706:
URL: https://github.com/apache/doris/pull/70706

   ### Background
   
   `SHOW CHARACTER SET` (also spelled `SHOW CHARSET`) returns the session's 
character set, description, default collation and maximum character length. 
MySQL clients can append `LIKE` or `WHERE` to filter this metadata.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #43155 (introduced the Nereids command)
   PR Type: Bugfix
   
   Problem Summary:
   
   The Nereids grammar only accepts the unfiltered command, so statements such 
as `SHOW CHARACTER SET WHERE charset = 'utf8mb4'` fail with a syntax error. Add 
both optional filter forms and apply them to the existing result values. `LIKE` 
matches character set names with the existing MySQL pattern matcher; `WHERE` 
uses a filtered one-row logical relation and the normal query 
analyzer/executor, preserving column binding, numeric comparisons, compound 
predicates, functions and NULL semantics.
   
   ### Details
   
   - **Frequency:** Every filtered `SHOW CHARACTER SET` or `SHOW CHARSET` 
statement fails before this fix.
   - **Root cause:** The Nereids grammar and command omit the optional 
`LIKE`/`WHERE` clauses.
   - **Why existing tests missed it:** The existing regression only executes 
unfiltered `SHOW CHARSET`.
   - **Fix:** Pass the parsed filter into the command. Preserve the existing 
session-dependent row and result metadata, use case-insensitive MySQL patterns 
for `LIKE`, and analyze/execute `WHERE` over typed output columns.
   - **Other paths and branches:** Both spellings share the fixed path. This PR 
targets master only; `SHOW COLLATION` is outside its scope.
   - **Behavior change:** Filtered statements execute and return matching rows 
or an empty result; unknown output columns are rejected. Unfiltered results 
remain unchanged.
   
   ### Testing
   
   - Local FE build and Checkstyle: `DISABLE_BUILD_UI=ON ./build.sh --fe -j8` — 
passed.
   - Local FE unit tests: `./run-fe-ut.sh --run 
org.apache.doris.nereids.trees.plans.commands.ShowCharsetCommandTest,org.apache.doris.nereids.parser.NereidsParserTest`
 — 98 tests passed (6 command tests and 92 parser tests), with no failures or 
skips.
   - SQL regression: `./run-regression-test.sh --run -d query_p0/show -s 
test_show_charset_command -forceGenOut`, followed by the same command without 
`-forceGenOut` — generated the expected file and checked it in an isolated 
Docker container using the newly built master FE and the official 4.1.5 BE. 
Covers both spellings, exact/wildcard/case-insensitive LIKE, all output 
columns, compound and numeric predicates, functions, WHERE LIKE/NOT LIKE, 
NULL/constant predicates, empty results and unknown-column errors.
   
   ### Release note
   
   Support `LIKE` and `WHERE` filters in `SHOW CHARACTER SET` and `SHOW 
CHARSET`, improving compatibility with MySQL clients that query character set 
metadata.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Ready (local FE checks and SQL regression passed; 
remote CI pending)
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Implementation, tests and PR description
   - Human review: Pending author review
   


-- 
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]

Reply via email to