yuqi1129 opened a new pull request, #10318:
URL: https://github.com/apache/gravitino/pull/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.


-- 
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]

Reply via email to