anchovYu opened a new pull request, #44328: URL: https://github.com/apache/spark/pull/44328
### What changes were proposed in this pull request? When the SQL conf `spark.sql.legacy.keepCommandOutputSchema` is set to true: Before: ``` // support there is a xyyu-db-with-hyphen schema in the catalog spark.catalog.listDatabases() [INVALID_IDENTIFIER] The identifier xyyu-db-with-hyphen is invalid. Please, consider quoting it with back-quotes as `xyyu-db-with-hyphen`. SQLSTATE: 42602 (line 1, pos 4) ``` After: ``` spark.catalog.listDatabases() .. `xyyu-db-with-hyphen` .. ``` This PR fixes the issue by forcing the problematic step in listDatabases to be executed with non-legacy mode, so that the value returned is guaranteed to be quoted. ### Why are the changes needed? To fix the bug. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Newly added tests. ### Was this patch authored or co-authored using generative AI tooling? <!-- If generative AI tooling has been used in the process of authoring this patch, please include the phrase: 'Generated-by: ' followed by the name of the tool and its version. If no, write 'No'. Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details. --> -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org