You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Low Risk
Metadata-only change to getTypeInfo() result shaping; no query execution or connection behavior changes. Wrong literals could mislead BI/SQL generators but scope is limited to JDBC metadata consumers.
Overview DatabaseMetaData#getTypeInfo() now fills LITERAL_PREFIX and LITERAL_SUFFIX per type instead of leaving them always null, aligning JDBC v2 with v1 behavior for tools that build SQL literals from type metadata.
A static TYPE_LITERAL_INFO_MAP (Guava ImmutableMap) maps ClickHouse type names—and many SQL-style aliases—to quote ('), bracket ([]), brace ({}), or parenthesis delimiters. A new row mutator TYPE_INFO_LITERAL_FUNCTION runs with the existing getTypeInfo post-processors to set those columns when a type is known; numeric and similar types stay null.
testGetTypeInfo gains TYPE_LITERAL_EXPECTATIONS and asserts prefix/suffix per ClickHouseDataType so regressions are caught in integration tests.
Reviewed by Cursor Bugbot for commit 7156c2e. Bugbot is set up for automated code reviews on this repo. Configure here.
Repository collaborators can run the JMH benchmark suite against this PR by commenting:
/benchmark
Optional regression threshold override (Δ% on Time or Alloc/op; defaults to 10%):
/benchmark threshold=15
Only one benchmark run per PR is active at a time — issuing a new /benchmark comment cancels the previous run. After the run finishes a separate comment will be posted comparing it against the latest scheduled run on main; the PR check fails if any benchmark regresses by more than the threshold.
Summary
This PR fixes DatabaseMetaData#getTypeInfo() in jdbc-v2 to return proper LITERAL_PREFIX and LITERAL_SUFFIX values (e.g. ' for string/date/enum types, [/] for arrays/geo, {/} for maps, (/) for tuples/geo) instead of always returning null. A static ImmutableMap<String, TypeLiteralInfo> covering ~50 ClickHouse native and SQL-alias type names drives a new TYPE_INFO_LITERAL_FUNCTION row mutator that runs alongside the existing getTypeInfo post-processors. The change aligns v2 behavior with v1 (documented in issue #2743) and adds an integration-test assertion table covering each affected ClickHouseDataType.
What this impacts
jdbc-v2/ only — DatabaseMetaDataImpl and its integration test
Any JDBC consumer (BI tools, ORM schema introspection, SQL generators) that calls getTypeInfo() and previously branched on null LITERAL_PREFIX/LITERAL_SUFFIX will now receive non-null values
Concerns
Medium rule fires: behavioral change in jdbc-v2, a designated hot-path module — LITERAL_PREFIX/LITERAL_SUFFIX columns change from always-null to type-specific values, which could silently affect downstream consumers that expected null.
CHANGELOG entry is missing (PR checklist item left unchecked).
Required reviewer action
At least one human reviewer.
chernser
changed the title
Added literal prefix and suffic to getTypeInfo() to be close to v1
Added literal prefix and suffix to getTypeInfo() to be close to v1
Jun 18, 2026
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the jdbc-v2DatabaseMetaData.getTypeInfo() implementation to populate the LITERAL_PREFIX and LITERAL_SUFFIX columns for ClickHouse types (closer to the v1 driver), and adds integration test assertions to prevent regressions.
Changes:
Add a type-name → literal delimiter mapping and apply it as a DetachedResultSet mutator in getTypeInfo().
Extend DatabaseMetaDataTest#testGetTypeInfo to assert expected literal prefix/suffix per ClickHouseDataType.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
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
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.
Summary
LITERAL_PREFIXandLITERAL_SUFFIXproper values inDataBaseMetadata#getTypeInforesult set. Previously information was all nullAfter the change type info looks like (nulls because no string literal should be used) :
Closes: #2743
Checklist
Delete items not relevant to your PR:
Note
Low Risk
Metadata-only change to getTypeInfo() result shaping; no query execution or connection behavior changes. Wrong literals could mislead BI/SQL generators but scope is limited to JDBC metadata consumers.
Overview
DatabaseMetaData#getTypeInfo()now fillsLITERAL_PREFIXandLITERAL_SUFFIXper type instead of leaving them always null, aligning JDBC v2 with v1 behavior for tools that build SQL literals from type metadata.A static
TYPE_LITERAL_INFO_MAP(GuavaImmutableMap) maps ClickHouse type names—and many SQL-style aliases—to quote ('), bracket ([]), brace ({}), or parenthesis delimiters. A new row mutatorTYPE_INFO_LITERAL_FUNCTIONruns with the existinggetTypeInfopost-processors to set those columns when a type is known; numeric and similar types stay null.testGetTypeInfogainsTYPE_LITERAL_EXPECTATIONSand asserts prefix/suffix perClickHouseDataTypeso regressions are caught in integration tests.Reviewed by Cursor Bugbot for commit 7156c2e. Bugbot is set up for automated code reviews on this repo. Configure here.