Skip to content

[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
cherry-pick-c1449a3b-to-branch-1.2
May 6, 2026
Merged

[Cherry-pick to branch-1.2] [#10316] fix(catalog-jdbc-clickhouse): normalize quoted string defaults (#10318)#10977
yuqi1129 merged 1 commit intobranch-1.2from
cherry-pick-c1449a3b-to-branch-1.2

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions Bot commented May 6, 2026

Cherry-pick Information:

  • Original commit: c1449a3
  • Target branch: branch-1.2
  • Status: ✅ Clean cherry-pick (no conflicts)

…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>
@github-actions github-actions Bot requested a review from jerryshao May 6, 2026 09:44
@yuqi1129 yuqi1129 closed this May 6, 2026
@yuqi1129 yuqi1129 reopened this May 6, 2026
@yuqi1129 yuqi1129 merged commit f953a0e into branch-1.2 May 6, 2026
26 checks passed
@yuqi1129 yuqi1129 deleted the cherry-pick-c1449a3b-to-branch-1.2 branch May 6, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant