tangrizzly opened a new pull request, #54076: URL: https://github.com/apache/spark/pull/54076
### What changes were proposed in this pull request? This PR fixes the handling of catalog names with special characters in the `SET CATALOG` command. The changes modify `ResolveSetCatalogCommand` to properly wrap identifier parts with backticks and escape any existing backticks by doubling them when converting `SET CATALOG` commands to string literals. ### Why are the changes needed? A previous change in https://github.com/apache/spark/pull/53941 extended the `SET CATALOG` command to accept foldable expressions. As part of that change, identifiers quoted with backticks are resolved to `Literal("some-identifier")` with the backticks stripped. This behavior breaks `SET CATALOG` when catalog names contain special characters such as %, @, -, $, #, or backticks. This fix wraps identifiers in explicit backticks and escapes any existing backticks, ensuring the catalog names are resolved correctly during analysis. ### Does this PR introduce _any_ user-facing change? Yes. Users can now use `SET CATALOG` with catalog names that contain special characters when properly quoted with backticks: - `SET CATALOG `te%s@t-c$a#t` - works with special characters - `SET CATALOG `test`quote` - works with backticks in the name (escaped by doubling) ### How was this patch tested? DataSourceV2SQLSuite: - SET CATALOG with special characters with backticks in identifier - SET CATALOG with backtick character in identifier ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Sonnet 4.5 - claude-sonnet-4-5-20250929) -- 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]
