[Cherry-pick to branch-1.2] [#10316] fix(catalog-jdbc-clickhouse): normalize quoted string defaults (#10318)#10977
Merged
yuqi1129 merged 1 commit intobranch-1.2from May 6, 2026
Conversation
…ts (#10318) ### What changes were proposed in this pull request? This PR fixes ClickHouse string default value SQL rendering when creating or altering tables via API. Changes: - Normalize quoted string literals in ClickHouseColumnDefaultValueConverter#fromGravitino. - If input is already wrapped by outer single quotes (for example, 'active'), strip the outer quotes before SQL wrapping. - Escape inner single quotes safely (' -> ''). - Add regression tests: - TestClickHouseTableOperations#testGenerateCreateTableSqlWithQuotedStringDefault - TestClickHouseTableOperations#testGenerateCreateTableSqlEscapesStringDefaultQuotes - CatalogClickHouseIT#testCreateTableWithQuotedStringDefaultLiteral ### Why are the changes needed? When API clients pass a string default like 'active' with surrounding quotes in the value, generated DDL became DEFAULT ''active'' instead of DEFAULT 'active'. Fix: #10316 ### Does this PR introduce _any_ user-facing change? Yes. Creating/altering ClickHouse tables with quoted string defaults now generates correct SQL defaults and preserves expected values. ### How was this patch tested? Ran: ./gradlew --no-daemon -p catalogs-contrib/catalog-jdbc-clickhouse test --tests org.apache.gravitino.catalog.clickhouse.operations.TestClickHouseTableOperations --tests org.apache.gravitino.catalog.clickhouse.integration.test.CatalogClickHouseIT All targeted tests passed. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick Information:
branch-1.2