linzch3 opened a new pull request, #70236: URL: https://github.com/apache/doris/pull/70236
### Background `information_schema` reports a database as a schema name built by `InfoSchemaDb.getMysqlTableSchema`: the raw name, or `catalog.db` for an external catalog when `show_full_dbname_in_info_schema_db` is on. When the BE asks the FE for tables or columns of that schema, `getDbNameFromMysqlTableSchema` turns it back into the database name before `catalog.getDbNullable`. ### What problem does this PR solve? Issue Number: close #69085 Related PR: None PR Type: Bugfix Problem Summary: The decoder split the schema name on dots and returned the second part whenever there were exactly two. An Iceberg nested namespace such as `gold.reporting` was therefore looked up as `reporting`, so `information_schema.tables`/`columns` and `SHOW TABLE STATUS` came back empty for it (or could hit a different database named `reporting`). With the full-name setting on, `cat.gold.reporting` has three parts and was not decoded at all. The fix makes the decoder the exact inverse of the encoder: return the name unchanged when the setting is off or the catalog is internal, otherwise strip only the `catalog.` prefix. ### Details - **Frequency:** Every external database whose name contains a dot, e.g. nested Iceberg REST namespaces. - **Root cause:** The decoder guessed the catalog qualifier from the number of dots instead of using the setting and catalog name that the encoder uses. - **Why existing tests missed it:** There was no test of the encode/decode round trip, and no dotted database names in the unit tests. - **Fix:** Mirror the encoder's conditions and remove only the `catalog.` prefix. - **Other paths and branches:** All callers in `FrontendServiceImpl` (`getTableNames`, `listTableStatus`, `listTableMetadataNameIds`, `describeTables`) go through this helper, so they are covered together. The separate per-table metadata-failure point raised in the issue is not addressed here. ### Testing `InfoSchemaDbTest` gains a round-trip test over both settings, internal and external catalogs, and one-, two- and three-part names, including a database that starts with the catalog name (`ctl.db` in catalog `ctl`). Two of the new tests fail on master (`expected: <gold.reporting> but was: <reporting>`) and pass with the fix. Ran locally; fe-core checkstyle is clean. ### Notes for Reviewers With the setting off, a name arriving as `ctl.db` is now always treated as the raw database name. Before, it was decoded to `db`. As far as I can tell the FE never emits `ctl.db` with the setting off, so that branch only hurt real dotted names, but please shout if some client relies on it. ### Release note Fix information_schema.tables/columns and SHOW TABLE STATUS returning no rows for external databases whose names contain a dot, such as nested Iceberg namespaces. ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Partially verified: unit tests only, not checked against a running cluster with a nested-namespace catalog ### AI Disclosure - Tool: an AI coding assistant - Generated: code, tests and this description - Human review: AI-assisted, reviewed by me -- 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]
