924060929 opened a new pull request, #70782: URL: https://github.com/apache/doris/pull/70782
### What problem does this PR solve? Backport of #70706 (related: #43155) to `branch-4.1`. `SHOW CHARACTER SET` and `SHOW CHARSET` reject the optional `WHERE` and `LIKE` clauses used by MySQL clients. Both forms now filter the existing FE row with the character set name, description, default collation and maximum length. - `LIKE` decodes the SQL string literal in the current SQL mode before matching the character set name with the existing case-insensitive pattern matcher. - `WHERE` binds the output column names in Nereids and evaluates the predicate over a typed single-row relation. A scoped internal MySQL text query uses the caller's session settings and prepared bindings. The outer SHOW owns its query state and sends the resulting rows in the client's protocol. - SHOW's internal filter skips SQL result caching and the automatic SELECT limit. The predicate can still read the original session variables. ### Backport adaptation This branch does not have every master-only building block the original PR relied on: - `ConnectContext` still uses `MysqlChannel`: `createInternalQueryContext` builds a `DummyMysqlChannel` (master uses `MysqlProtocolAdapter`). `branch-4.1` has no `startTimeInstant`, so that field is not copied. - `StmtExecutor#setCancelDelegate` / `clearCancelDelegate` exist only on master (#70607), so cancelling the client query does not propagate to the internal filter query on this branch. `branch-4.1` still checks the pending cancel reason before the filter starts. - `ResultRow` is `org.apache.doris.statistics.ResultRow` on this branch, not `org.apache.doris.statistics.repository.ResultRow`. - `branch-4.1` cannot compute one-row-relation plans in the FE (`PhysicalOneRowRelation` does not implement `ComputeResultSet`), so an FE unit test has no backend that can execute the internal filter query. The unit tests that assert `WHERE` row results are `@Disabled` with an explanatory comment; the WHERE semantics are covered by the regression suites `test_show_charset_command` and `test_show_charset_over_arrow_flight` in a real cluster. ### Testing - Local FE build (`mvn package -pl fe-core -am`) and Checkstyle for `branch-4.1`. - FE unit tests `ShowCharsetCommandTest` and `ConnectContextTest` pass; the three WHERE tests that need a backend are disabled as described above. - Regression suites are the ones validated on master; CI should run them against this branch. ### Release note Support `WHERE` and `LIKE` filters in `SHOW CHARACTER SET` and `SHOW CHARSET`. -- 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]
