[#12913] fix(clickhouse): preserve quoted commas in table settings - #12918
Draft
jiangxt2 wants to merge 1 commit into
Draft
[#12913] fix(clickhouse): preserve quoted commas in table settings#12918jiangxt2 wants to merge 1 commit into
jiangxt2 wants to merge 1 commit into
Conversation
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.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.
What changes were proposed in this pull request?
This pull request fixes ClickHouse table-level SETTINGS readback when a scalar literal contains commas.
ClickHouseTableOperations.parseSettingsClause()with top-level delimiter parsing that ignores commas and equals signs inside quoted text and nested parentheses.settings.*property representation, including the current last-value-wins behavior for duplicate keys.No public API, property key, dependency, documentation, ALTER behavior, or general SQL parsing capability is changed.
Why are the changes needed?
The ClickHouse catalog reads table-level settings from
system.tables.engine_full, but the current parser splits the SETTINGS clause at every comma. A valid String setting such asmerge_workload = 'gravitino,quoted,comma'is therefore loaded as only'gravitino, even though ClickHouse preserves the complete literal. Recreating a table from the loaded property cannot retain the original value.The existing write path already treats each
settings.*value as one complete ClickHouse scalar literal, so this change restores read/write symmetry without changing the property contract.Fix: #12913
Does this PR introduce any user-facing change?
Yes. Loading a ClickHouse table now preserves complete table-level setting values when quoted text or nested function-style values contain commas. Existing simple settings and
settings.*property keys are unchanged. Structurally malformed SETTINGS metadata now fails explicitly instead of being silently ignored or converted into truncated properties.How was this patch tested?
./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:spotlessCheck— passed../gradlew rat— passed../gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test -PskipITs— passed, including quoted-comma, escaping, doubled-quote, nested-parenthesis, duplicate-key, malformed-metadata, engine-parameter, and Graphite regression coverage../gradlew :catalogs-contrib:catalog-jdbc-clickhouse:build -x test— passed../gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test --tests 'org.apache.gravitino.catalog.clickhouse.integration.test.CatalogClickHouseIT.testLoadAndRecreateTableWithQuotedCommaSetting' -PskipDockerTests=false— passed against the project ClickHouse 24.8.14 image withtests=1,skipped=0,failures=0, anderrors=0../gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test --tests 'org.apache.gravitino.catalog.clickhouse.integration.test.CatalogClickHouseClusterIT' -PskipDockerTests=false— passed against the project three-node ClickHouse 24.8.14 cluster fixture withtests=19,skipped=0,failures=0, anderrors=0.