Repository navigation
[jdbc-v2] Fix the type name of Nullable(Tuple(...)) columns - #3383
Open
Indian-boult wants to merge 1 commit into
Open
Indian-boult wants to merge 1 commit into
Indian-boult wants to merge 1 commit into
Conversation
ClickHouseColumn.readColumn counts the opening brackets of the Nullable and LowCardinality wrappers, but only the branch for types without parameters read the matching closing brackets. The branches for Array, Map, Nested, Tuple, Variant, JSON, QBit and AggregateFunction ended the type name at their own closing bracket. So Nullable(Tuple(Int32, String)) was named Nullable(Tuple(Int32, String) and the returned index pointed at the closing bracket of the wrapper. After those branches, read the closing brackets of the wrappers and include them in the type name and in the returned index. Closes ClickHouse#3382
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.
Summary
ClickHouseColumnnamed aNullable(Tuple(...))column one closing parenthesis short, for exampleNullable(Tuple(Int32, String). jdbc-v2 returned this name fromResultSetMetaData#getColumnTypeName,Array#getBaseTypeNameandStruct#getSQLTypeName.Array#getResultSet()of aNestedvalue with aNullable(Tuple(...))field failed withIllegalArgumentException. client-v2 returned the short name inClient#getTableSchema.readColumnnow reads the closing brackets of theNullableandLowCardinalitywrappers afterArray,Map,Nested,Tuple,Variant,JSON,QBitandAggregateFunction, the same as it already does for types without parameters. The type name and the returned index include them.Nullable(JSON(...))andNullable(QBit(...))get the right name too.Two edge cases change.
Map(Nullable(Tuple(...)), String)failed to parse and now parses, the same asMap(Nullable(String), String). The server rejects both. In a type name that the application writes, an element afterx Nullable(Tuple(...) )with a space before the last parenthesis was lost and is now kept. No public API changes.Closes #3382
Checklist
getColumnTypeNamereturnsNullable(Tuple(...))without its last closing parenthesis #3382Note
Medium Risk
Changes core type-string parsing used across JDBC and client metadata; regressions could affect any parameterized nullable column name, though behavior is narrowly scoped and well covered by new tests.
Overview
Fixes truncated SQL type strings for columns wrapped in
Nullable(...)orLowCardinality(...)when the inner type is parameterized (Tuple,JSON,QBit, etc.).ClickHouseColumn.readColumnnow consumes the wrapper’s closing)after those branches finish, sogetOriginalTypeName()is complete—for exampleNullable(Tuple(Int32, String))instead of a missing final parenthesis.That full name flows through jdbc-v2 and client-v2 metadata paths (
ResultSetMetaData#getColumnTypeName, array/struct type names,Client#getTableSchema) and avoids re-parse failures such asArray#getResultSet()onNestedfields containing nullable tuples.Tests add unit coverage for nullable shapes inside
Array/Map/Tupleand an integration test for nullable tuple metadata on ClickHouse 26.1+.Reviewed by Cursor Bugbot for commit 8125511. Bugbot is set up for automated code reviews on this repo. Configure here.