Skip to content

[client-v2,jdbc-v2] Support Geometry Type#2815

Open
chernser wants to merge 12 commits intomainfrom
03/31/26/support_geometry_type
Open

[client-v2,jdbc-v2] Support Geometry Type#2815
chernser wants to merge 12 commits intomainfrom
03/31/26/support_geometry_type

Conversation

@chernser
Copy link
Copy Markdown
Contributor

@chernser chernser commented Mar 31, 2026

Description

ClickHouse supports many geometry types like Point, Ring, Polygon and others (https://clickhouse.com/docs/sql-reference/data-types/geo). There was an alias type Geometry that pointed to a String type. When this type is used it was replaced by String. This very well works with WKT functions (https://clickhouse.com/blog/state-of-geospatial-march-2026#ingesting-geospatial-data-via-wkt) that can parse different geometry notations.

When Variant type was introduced it made possible to have better type alias so in 25.11 Geometry type became a real type not an alias. This doesn't break backward compatibility because String when table was created. However today cast to Geometry means different thing.

Variant type of Geometry has a predefined list of types. Because of this we can pre-define column of such type and use it in serialization logic (client code uses ClickHouseColumn object to define how value should be serialized and deserialized). Reading Geometry type is easy task because we client matches type ordinary number to java type. Here we should note that Ring and LineString are Array(Point) making them effectively same from data structure standpoint. Similar with MultiLineString and Polygon are defined as Array(LineString) and Array(Ring) respectively. This make type inference on a write operation complicated because task is to match array with specific nesting level to a type and use correct ordinary number.

There should be a dedicated method to determine java array depth. Similar should exist for List. These only type client support to be written to geometry types. Because we deal with limited number of array types it is more safe to use instanceof Double[] like statement instead of traversing whole array that can be quite big. In the future we will introduce some type hinting mechanism with annotations to make interface for type-safe.

This PR:

  • Adds new type to ClickHouseDataType enum
  • Adds Geometry Variant defined column to ClickHouseColumn and implement reading Geometry columns definitions.
  • Adds method to determine array dimensions to SerializationUtils
  • Adds method to determine ordinary number of type for array or list of specific depth.
  • Adds tests for write and read.

Closes: #2678

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 31, 2026

Client V2 Coverage

Coverage Report

Package Coverage Lines Covered Total Lines
com.clickhouse.client.api 82.68% 912 1103
com.clickhouse.client.api.command 46.43% 13 28
com.clickhouse.client.api.data_formats 40.29% 141 350
com.clickhouse.client.api.data_formats.internal 74.88% 1723 2301
com.clickhouse.client.api.enums 100.00% 5 5
com.clickhouse.client.api.http 0.00% 1
com.clickhouse.client.api.insert 85.15% 86 101
com.clickhouse.client.api.internal 81.69% 1035 1267
com.clickhouse.client.api.metadata 90.74% 49 54
com.clickhouse.client.api.metrics 93.75% 75 80
com.clickhouse.client.api.query 78.88% 127 161
com.clickhouse.client.api.serde 84.21% 48 57
com.clickhouse.client.api.sql 87.50% 28 32
com.clickhouse.client.api.transport 89.29% 50 56
Class Coverage
Class Coverage Lines Covered Total Lines
com.clickhouse.client.api.ClickHouseException 85.71% 12 14
com.clickhouse.client.api.Client 84.72% 377 445
com.clickhouse.client.api.Client.Builder 80.37% 176 219
com.clickhouse.client.api.Client.new DataStreamWriter() {...} 100.00% 8 8
com.clickhouse.client.api.ClientConfigProperties 93.37% 183 196
com.clickhouse.client.api.ClientConfigProperties.new ClientConfigProperties() {...} 100.00% 8 8
com.clickhouse.client.api.ClientException 100.00% 4 4
com.clickhouse.client.api.ClientFaultCause 100.00% 7 7
com.clickhouse.client.api.ClientMisconfigurationException 50.00% 2 4
com.clickhouse.client.api.command.CommandResponse 47.06% 8 17
com.clickhouse.client.api.command.CommandSettings 45.45% 5 11
com.clickhouse.client.api.ConnectionInitiationException 50.00% 3 6
com.clickhouse.client.api.ConnectionReuseStrategy 100.00% 3 3
com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader 72.35% 293 405
com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.RecordWrapper 50.00% 17 34
com.clickhouse.client.api.data_formats.internal.BinaryReaderBackedRecord 14.77% 13 88
com.clickhouse.client.api.data_formats.internal.BinaryStreamReader 84.74% 372 439
com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.ArrayValue 81.40% 35 43
com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.CachingByteBufferAllocator 100.00% 8 8
com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.DefaultByteBufferAllocator 100.00% 2 2
com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.EnumValue 80.00% 8 10
com.clickhouse.client.api.data_formats.internal.InetAddressConverter 66.67% 18 27
com.clickhouse.client.api.data_formats.internal.MapBackedRecord 45.54% 102 224
com.clickhouse.client.api.data_formats.internal.NumberConverter 88.17% 82 93
com.clickhouse.client.api.data_formats.internal.NumberConverter.NumberType 100.00% 7 7
com.clickhouse.client.api.data_formats.internal.ProcessParser 82.50% 33 40
com.clickhouse.client.api.data_formats.internal.SerializerUtils 83.96% 644 767
com.clickhouse.client.api.data_formats.internal.SerializerUtils.DynamicClassLoader 100.00% 3 3
com.clickhouse.client.api.data_formats.internal.ValueConverters 77.48% 86 111
com.clickhouse.client.api.data_formats.NativeFormatReader 80.77% 42 52
com.clickhouse.client.api.data_formats.NativeFormatReader.Block 66.67% 12 18
com.clickhouse.client.api.data_formats.RowBinaryFormatReader 15.79% 3 19
com.clickhouse.client.api.data_formats.RowBinaryFormatSerializer 19.82% 22 111
com.clickhouse.client.api.data_formats.RowBinaryFormatWriter 27.84% 27 97
com.clickhouse.client.api.data_formats.RowBinaryFormatWriter.InputStreamHolder 0.00% 4
com.clickhouse.client.api.data_formats.RowBinaryFormatWriter.ReaderHolder 0.00% 4
com.clickhouse.client.api.data_formats.RowBinaryWithNamesAndTypesFormatReader 100.00% 22 22
com.clickhouse.client.api.data_formats.RowBinaryWithNamesFormatReader 56.52% 13 23
com.clickhouse.client.api.DataStreamWriter 0.00% 1
com.clickhouse.client.api.DataTransferException 50.00% 2 4
com.clickhouse.client.api.DataTypeUtils 52.50% 63 120
com.clickhouse.client.api.enums.Protocol 100.00% 2 2
com.clickhouse.client.api.enums.ProxyType 100.00% 3 3
com.clickhouse.client.api.http.ClickHouseHttpProto 0.00% 1
com.clickhouse.client.api.insert.InsertResponse 52.94% 9 17
com.clickhouse.client.api.insert.InsertSettings 91.67% 77 84
com.clickhouse.client.api.internal.BaseCollectionConverter 100.00% 28 28
com.clickhouse.client.api.internal.BaseCollectionConverter.BaseArrayWriter 100.00% 6 6
com.clickhouse.client.api.internal.BaseCollectionConverter.BaseCollectionWriter 71.43% 15 21
com.clickhouse.client.api.internal.BaseCollectionConverter.BaseListWriter 100.00% 6 6
com.clickhouse.client.api.internal.BaseCollectionConverter.ListConversionState 100.00% 11 11
com.clickhouse.client.api.internal.BasicObjectsPool 0.00% 11
com.clickhouse.client.api.internal.CachingObjectsSupplier 0.00% 10
com.clickhouse.client.api.internal.ClickHouseLZ4InputStream 89.33% 67 75
com.clickhouse.client.api.internal.ClickHouseLZ4OutputStream 92.31% 60 65
com.clickhouse.client.api.internal.ClientStatisticsHolder 50.00% 7 14
com.clickhouse.client.api.internal.CommonSettings 97.14% 68 70
com.clickhouse.client.api.internal.CompressedEntity 80.00% 28 35
com.clickhouse.client.api.internal.DataTypeConverter 87.57% 155 177
com.clickhouse.client.api.internal.DataTypeConverter.ArrayAsStringWriter 100.00% 18 18
com.clickhouse.client.api.internal.DataTypeConverter.ListAsStringWriter 100.00% 16 16
com.clickhouse.client.api.internal.EnvUtils 0.00% 14
com.clickhouse.client.api.internal.Gauge 66.67% 4 6
com.clickhouse.client.api.internal.HttpAPIClientHelper 89.39% 438 490
com.clickhouse.client.api.internal.HttpAPIClientHelper.CustomSSLConnectionFactory 0.00% 9
com.clickhouse.client.api.internal.HttpAPIClientHelper.DummySSLConnectionSocketFactory 0.00% 3
com.clickhouse.client.api.internal.HttpAPIClientHelper.MeteredManagedHttpClientConnectionFactory 50.00% 7 14
com.clickhouse.client.api.internal.LZ4Entity 82.93% 34 41
com.clickhouse.client.api.internal.MapUtils 35.48% 22 62
com.clickhouse.client.api.internal.ServerSettings 0.00% 1
com.clickhouse.client.api.internal.StopWatch 66.67% 10 15
com.clickhouse.client.api.internal.TableSchemaParser 80.77% 21 26
com.clickhouse.client.api.internal.ValidationUtils 55.00% 11 20
com.clickhouse.client.api.internal.ValidationUtils.SettingsValidationException 100.00% 3 3
com.clickhouse.client.api.metadata.DefaultColumnToMethodMatchingStrategy 100.00% 13 13
com.clickhouse.client.api.metadata.NoSuchColumnException 0.00% 2
com.clickhouse.client.api.metadata.TableSchema 92.31% 36 39
com.clickhouse.client.api.metrics.ClientMetrics 100.00% 7 7
com.clickhouse.client.api.metrics.MicrometerLoader 90.91% 40 44
com.clickhouse.client.api.metrics.OperationMetrics 94.12% 16 17
com.clickhouse.client.api.metrics.ServerMetrics 100.00% 12 12
com.clickhouse.client.api.query.NullValueException 50.00% 2 4
com.clickhouse.client.api.query.QueryResponse 60.98% 25 41
com.clickhouse.client.api.query.QuerySettings 96.43% 81 84
com.clickhouse.client.api.query.QueryStatement 0.00% 4
com.clickhouse.client.api.query.Records 60.87% 14 23
com.clickhouse.client.api.query.Records.new Iterator() {...} 100.00% 5 5
com.clickhouse.client.api.serde.DataSerializationException 0.00% 6
com.clickhouse.client.api.serde.POJOSerDe 97.96% 48 49
com.clickhouse.client.api.serde.SerializerNotFoundException 0.00% 2
com.clickhouse.client.api.ServerException 100.00% 13 13
com.clickhouse.client.api.ServerException.ErrorCodes 100.00% 9 9
com.clickhouse.client.api.Session 100.00% 42 42
com.clickhouse.client.api.sql.SQLUtils 87.50% 28 32
com.clickhouse.client.api.transport.HttpEndpoint 88.00% 44 50
com.clickhouse.client.api.transport.HttpEndpoint.EndpointDetails 100.00% 6 6

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 31, 2026

JDBC V2 Coverage

Coverage Report

Package Coverage Lines Covered Total Lines
com.clickhouse.data 19.23% 5 26
com.clickhouse.jdbc 78.38% 1555 1984
com.clickhouse.jdbc.internal 88.45% 1179 1333
com.clickhouse.jdbc.internal.parser.antlr4 40.76% 6367 15619
com.clickhouse.jdbc.internal.parser.javacc 71.35% 4771 6687
com.clickhouse.jdbc.metadata 84.20% 469 557
com.clickhouse.jdbc.types 55.14% 279 506
Class Coverage
Class Coverage Lines Covered Total Lines
com.clickhouse.data.Tuple 19.23% 5 26
com.clickhouse.jdbc.ClientInfoProperties 100.00% 12 12
com.clickhouse.jdbc.ConnectionImpl 89.41% 228 255
com.clickhouse.jdbc.DataSourceImpl 96.15% 25 26
com.clickhouse.jdbc.Driver 79.17% 38 48
com.clickhouse.jdbc.Driver.FrameworksDetection 90.91% 10 11
com.clickhouse.jdbc.DriverProperties 92.86% 26 28
com.clickhouse.jdbc.internal.DetachedResultSet 80.39% 332 413
com.clickhouse.jdbc.internal.ExceptionUtils 69.57% 16 23
com.clickhouse.jdbc.internal.FeatureManager 100.00% 8 8
com.clickhouse.jdbc.internal.JdbcConfiguration 94.61% 158 167
com.clickhouse.jdbc.internal.JdbcUtils 89.22% 364 408
com.clickhouse.jdbc.internal.JdbcUtils.ArrayProcessingCursor 100.00% 11 11
com.clickhouse.jdbc.internal.ParsedPreparedStatement 96.08% 49 51
com.clickhouse.jdbc.internal.ParsedStatement 93.75% 15 16
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseLexer 77.78% 28 36
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser 45.55% 4793 10522
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AliasContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterPrivilegeContext 0.00% 44
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseAddColumnContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseAddIndexContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseAddProjectionContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseAlterTypeContext 31.25% 5 16
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseAttachContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseClearColumnContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseClearIndexContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseClearProjectionContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseCommentContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDeleteContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDetachContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDropColumnContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDropIndexContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDropPartitionContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseDropProjectionContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseFreezePartitionContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseMaterializeIndexContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseMaterializeProjectionContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyCodecContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyCommentContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyContext 50.00% 5 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyOrderByContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyRemoveContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseModifyTTLContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseMovePartitionContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseRemoveTTLContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseRenameContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseReplaceContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableClauseUpdateContext 0.00% 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableColumnPositionContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AlterTableStmtContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ArrayJoinClauseContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentExprContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentExprListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentValueContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentValuesContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentValuesEmptyContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AssignmentValuesListContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.AttachStmtContext 33.33% 6 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CheckAllTablesStmtContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CheckGrantStmtContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CheckStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CheckTableStmtContext 35.71% 5 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ClusterClauseContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CodecArgExprContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CodecExprContext 0.00% 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnAliasesContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnArgExprContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnArgListContext 46.15% 6 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprAgrFuncWithFilterContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprAliasContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprAndContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprArrayAccessContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprArrayContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprAsteriskContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprBetweenContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprCaseContext 35.71% 5 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprCast2Context 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprCastContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprDateContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprExtractContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprFunctionContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprIdentifierContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprIntervalContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprIsNullContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprLiteralContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprNegateContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprNotContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprOrContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprParamContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprParensContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprPrecedence1Context 50.00% 5 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprPrecedence2Context 50.00% 5 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprPrecedence3Context 26.32% 5 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprRegexpContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprSubqueryContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprSubstringContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprTernaryOpContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprTimestampContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprTrimContext 0.00% 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprTupleAccessContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprTupleContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprWinFunctionContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnExprWinFunctionTargetContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnIdentifierContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnLambdaExprContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnPrivilegeContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnsClauseContext 53.85% 7 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnsExprAsteriskContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnsExprColumnContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnsExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnsExprSubqueryContext 0.00% 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprComplexContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprEnumContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprNestedContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprParamContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ColumnTypeExprSimpleContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateDatabaseStmtContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateDictionaryStmtContext 21.74% 5 23
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateFunctionStmtContext 33.33% 5 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateLiveViewStmtContext 0.00% 21
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateMaterializedViewStmtContext 0.00% 20
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateNamedCollectionStmtContext 27.78% 5 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreatePolicyStmtContext 17.24% 5 29
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreatePrivilegeContext 0.00% 24
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateProfileStmtContext 14.71% 5 34
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateQuotaStmtContext 18.52% 5 27
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateRoleStmtContext 26.32% 5 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateTableStmtContext 25.00% 5 20
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateUserStmtContext 17.86% 5 28
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CreateViewStmtContext 26.32% 5 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteClauseContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteUnboundColContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteUnboundColExprContext 50.00% 5 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteUnboundColLiteralContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteUnboundColParamContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.CteUnboundSubQueryContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DatabaseIdentifierContext 63.64% 7 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DataClauseContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DataClauseFormatContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DataClauseSelectContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DataClauseValuesContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DeleteStmtContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DescribeStmtContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DestinationClauseContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionaryArgExprContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionaryAttrDfntContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionaryEngineClauseContext 75.00% 6 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionaryPrimaryKeyClauseContext 46.15% 6 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionarySchemaClauseContext 46.15% 6 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DictionarySettingsClauseContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DropPrivilegeContext 0.00% 24
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.DropStmtContext 15.00% 6 40
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.EngineClauseContext 75.00% 6 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.EngineExprContext 46.15% 6 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.EnumValueContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ExchangeStmtContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ExistsDatabaseStmtContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ExistsStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ExistsTableStmtContext 31.25% 5 16
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ExplainStmtContext 33.33% 6 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.FilenameContext 0.00% 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.FloatingLiteralContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.FrameBetweenContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.FrameStartContext 0.00% 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.FromClauseContext 36.84% 7 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.GrantStmtContext 20.69% 6 29
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.GrantTableIdentifierContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.GroupByClauseContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.HavingClauseContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.IdentifierContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.IdentifierOrNullContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.InserParameterExprContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.InsertParameterContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.InsertParameterFuncExprContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.InsertRawValueContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.InsertStmtContext 53.33% 8 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.IntervalContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinConstraintClauseContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinExprCrossOpContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinExprOpContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinExprParensContext 0.00% 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinExprTableContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinOpContext 0.00% 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinOpCrossContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinOpFullContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinOpInnerContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.JoinOpLeftRightContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.KeywordContext 1.89% 6 318
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.KeywordForAliasContext 2.33% 6 258
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.KillMutationStmtContext 35.71% 5 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.KillQueryStmtContext 35.71% 5 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.KillStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LayoutClauseContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LifetimeClauseContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LimitByClauseContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LimitClauseContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LimitExprContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.LiteralContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.MoveStmtContext 33.33% 6 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.NameCollectionKeyContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.NamedQueryContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.NestedIdentifierContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.NumberLiteralContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.OptimizeByExprContext 30.00% 6 20
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.OptimizeStmtContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.OrderByClauseContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.OrderExprContext 37.50% 6 16
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.OrderExprListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PartitionByClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PartitionClauseContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PrewhereClauseContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PrimaryKeyClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PrivelegeListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.PrivilegeContext 13.64% 6 44
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ProjectionOrderByClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ProjectionSelectStmtContext 0.00% 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.QueryContext 38.24% 13 34
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.QueryStmtContext 46.67% 7 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.QuotaForClauseContext 33.33% 6 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.QuotaMaxExprContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.RangeClauseContext 0.00% 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.RatioExprContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.RenameStmtContext 37.50% 6 16
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.RevokeStmtContext 26.09% 6 23
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SampleByClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SampleClauseContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SchemaAsFunctionClauseContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SchemaAsTableClauseContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SchemaDescriptionClauseContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SelectStmtContext 21.43% 6 28
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SelectStmtWithParensContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SelectUnionStmtContext 40.00% 6 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SetRolesListContext 63.64% 7 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SetRoleStmtContext 38.10% 8 21
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SetStmtContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SettingExprContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SettingExprListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SettingsClauseContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowAccessStmtContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowClustersStmtContext 27.78% 5 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowClusterStmtContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowColumnsStmtContext 23.81% 5 21
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreatePolicyStmtContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreateProfileContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreateQuotaStmtContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreateRoleStmtContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreateStmtContext 27.78% 5 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowCreateUserStmtContext 38.46% 5 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowDatabasesStmtContext 0.00% 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowDictionariesStmtContext 26.32% 5 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowEnginesStmtContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowFromDbClauseContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowFromTableFromDbClauseContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowFSCachesStmtContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowFunctionsStmtContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowGrantsStmtContext 33.33% 5 15
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowIndexStmtContext 22.73% 5 22
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowMergesStmtContext 27.78% 5 18
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowPoliciesStmtContext 50.00% 5 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowPrivilegeContext 0.00% 25
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowProcessListStmtContext 41.67% 5 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowProfilesStmtContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowQuotasStmtContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowQuotaStmtContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowRolesStmtContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowSettingsStmtContext 45.45% 5 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowSettingStmtContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowStmtContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowTablesStmtContext 23.81% 5 21
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ShowUsersStmtContext 71.43% 5 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SourceClauseContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SourcePrivilegeContext 0.00% 25
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SubqueryClauseContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SystemPrivilegeContext 0.00% 81
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.SystemStmtContext 5.88% 6 102
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableArgExprContext 60.00% 6 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableArgListContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableColumnDfntContext 35.29% 6 17
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableColumnPropertyExprContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableColumnPropertyTypeContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableElementExprColumnContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableElementExprConstraintContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableElementExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableElementExprIndexContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableElementExprProjectionContext 0.00% 7
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableExprAliasContext 55.56% 5 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableExprContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableExprFunctionContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableExprIdentifierContext 100.00% 6 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableExprSubqueryContext 62.50% 5 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableFunctionExprContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableIdentifierContext 80.00% 8 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableIndexDfntContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableProjectionDfntContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TableSchemaClauseContext 83.33% 5 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TopClauseContext 0.00% 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TruncateStmtContext 42.86% 6 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TtlClauseContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.TtlExprContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UndropStmtContext 50.00% 6 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UpdateStmtContext 46.15% 6 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserCreateGranteesClauseContext 0.00% 19
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserCreateHostClauseContext 0.00% 14
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserCreateHostDefContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserIdentifiedClauseContext 27.27% 6 22
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserIdentifiedWithClauseContext 17.14% 6 35
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UserIdentifierContext 54.55% 6 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UseStmtContext 77.78% 7 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.UuidClauseContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ValidUntilClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ViewIdentifierContext 0.00% 8
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.ViewParamContext 63.64% 7 11
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WatchStmtContext 0.00% 12
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WhereClauseContext 66.67% 6 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WindowClauseContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WindowExprContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WinFrameBoundContext 0.00% 13
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WinFrameClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WinFrameExtendContext 0.00% 6
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WinOrderByClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WinPartitionByClauseContext 0.00% 10
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParser.WithClauseContext 0.00% 9
com.clickhouse.jdbc.internal.parser.antlr4.ClickHouseParserBaseListener 64.86% 382 589
com.clickhouse.jdbc.internal.parser.javacc.AbstractCharStream 43.88% 86 196
com.clickhouse.jdbc.internal.parser.javacc.ClickHouseSqlParser 71.22% 2873 4034
com.clickhouse.jdbc.internal.parser.javacc.ClickHouseSqlParserConstants 100.00% 1 1
com.clickhouse.jdbc.internal.parser.javacc.ClickHouseSqlParserTokenManager 82.98% 1648 1986
com.clickhouse.jdbc.internal.parser.javacc.ClickHouseSqlStatement 36.05% 53 147
com.clickhouse.jdbc.internal.parser.javacc.ClickHouseSqlUtils 68.57% 24 35
com.clickhouse.jdbc.internal.parser.javacc.JdbcParseHandler 24.05% 19 79
com.clickhouse.jdbc.internal.parser.javacc.LanguageType 100.00% 6 6
com.clickhouse.jdbc.internal.parser.javacc.OperationType 100.00% 2 2
com.clickhouse.jdbc.internal.parser.javacc.ParseException 3.95% 3 76
com.clickhouse.jdbc.internal.parser.javacc.ParseHandler 50.00% 2 4
com.clickhouse.jdbc.internal.parser.javacc.SimpleCharStream 30.00% 9 30
com.clickhouse.jdbc.internal.parser.javacc.StatementType 92.50% 37 40
com.clickhouse.jdbc.internal.parser.javacc.Token 66.67% 8 12
com.clickhouse.jdbc.internal.parser.javacc.TokenMgrException 0.00% 39
com.clickhouse.jdbc.internal.SqlParserFacade 90.63% 29 32
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4AndParamsParser 90.91% 10 11
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4AndParamsParser.ParseStatementAndParamsListener 92.86% 13 14
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4Parser 97.30% 36 37
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4Parser.ParsedPreparedStatementListener 94.34% 50 53
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4Parser.ParsedStatementListener 100.00% 15 15
com.clickhouse.jdbc.internal.SqlParserFacade.ANTLR4Parser.ParserErrorListener 100.00% 2 2
com.clickhouse.jdbc.internal.SqlParserFacade.JavaCCParser 98.53% 67 68
com.clickhouse.jdbc.internal.SqlParserFacade.SQLParser 100.00% 4 4
com.clickhouse.jdbc.JdbcV2Wrapper 100.00% 4 4
com.clickhouse.jdbc.metadata.DatabaseMetaDataImpl 81.57% 385 472
com.clickhouse.jdbc.metadata.DatabaseMetaDataImpl.TableType 100.00% 14 14
com.clickhouse.jdbc.metadata.ParameterMetaDataImpl 100.00% 23 23
com.clickhouse.jdbc.metadata.ResultSetMetaDataImpl 97.92% 47 48
com.clickhouse.jdbc.PreparedStatementImpl 77.30% 378 489
com.clickhouse.jdbc.PreparedStatementImpl.ArrayProcessingCursor 100.00% 7 7
com.clickhouse.jdbc.ResultSetImpl 82.20% 508 618
com.clickhouse.jdbc.StatementImpl 92.42% 256 277
com.clickhouse.jdbc.types.Array 88.00% 44 50
com.clickhouse.jdbc.types.ArrayResultSet 50.67% 227 448
com.clickhouse.jdbc.types.Struct 100.00% 8 8
com.clickhouse.jdbc.WriterStatementImpl 30.14% 63 209

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 31, 2026

JDBC V1 Coverage

Coverage Report

Package Coverage Lines Covered Total Lines
com.clickhouse.jdbc 35.25% 943 2675
com.clickhouse.jdbc.internal 63.24% 1330 2103
com.clickhouse.jdbc.parser 69.35% 4556 6570
Class Coverage
Class Coverage Lines Covered Total Lines
com.clickhouse.jdbc.AbstractResultSet 1.33% 3 226
com.clickhouse.jdbc.ClickHouseArray 34.62% 9 26
com.clickhouse.jdbc.ClickHouseBlob 0.00% 12
com.clickhouse.jdbc.ClickHouseClob 0.00% 14
com.clickhouse.jdbc.ClickHouseConnection 52.78% 19 36
com.clickhouse.jdbc.ClickHouseDatabaseMetaData 46.80% 183 391
com.clickhouse.jdbc.ClickHouseDataSource 47.06% 8 17
com.clickhouse.jdbc.ClickHouseDriver 72.73% 40 55
com.clickhouse.jdbc.ClickHousePreparedStatement 16.67% 13 78
com.clickhouse.jdbc.ClickHouseResultSet 64.84% 166 256
com.clickhouse.jdbc.ClickHouseResultSetMetaData 34.21% 13 38
com.clickhouse.jdbc.ClickHouseScrollableResultSet 0.00% 17
com.clickhouse.jdbc.ClickHouseStatement 0.00% 1
com.clickhouse.jdbc.ClickHouseStruct 71.43% 5 7
com.clickhouse.jdbc.ClickHouseXml 0.00% 10
com.clickhouse.jdbc.CombinedResultSet 51.88% 83 160
com.clickhouse.jdbc.DataSourceV1 69.70% 23 33
com.clickhouse.jdbc.DriverV1 40.63% 39 96
com.clickhouse.jdbc.DriverV1.FrameworksDetection 90.91% 10 11
com.clickhouse.jdbc.internal.AbstractPreparedStatement 27.59% 16 58
com.clickhouse.jdbc.internal.ClickHouseConnectionImpl 65.54% 369 563
com.clickhouse.jdbc.internal.ClickHouseJdbcUrlParser 100.00% 29 29
com.clickhouse.jdbc.internal.ClickHouseJdbcUrlParser.ConnectionInfo 100.00% 18 18
com.clickhouse.jdbc.internal.ClickHouseParameterMetaData 70.37% 19 27
com.clickhouse.jdbc.internal.ClickHouseStatementImpl 61.66% 283 459
com.clickhouse.jdbc.internal.InputBasedPreparedStatement 71.76% 183 255
com.clickhouse.jdbc.internal.JdbcSavepoint 100.00% 14 14
com.clickhouse.jdbc.internal.JdbcTransaction 72.50% 58 80
com.clickhouse.jdbc.internal.SqlBasedPreparedStatement 68.60% 236 344
com.clickhouse.jdbc.internal.StreamBasedPreparedStatement 45.21% 66 146
com.clickhouse.jdbc.internal.TableBasedPreparedStatement 35.45% 39 110
com.clickhouse.jdbc.JdbcConfig 71.84% 74 103
com.clickhouse.jdbc.JdbcParameterizedQuery 67.78% 61 90
com.clickhouse.jdbc.JdbcParseHandler 95.12% 78 82
com.clickhouse.jdbc.JdbcTypeMapping 42.96% 61 142
com.clickhouse.jdbc.JdbcTypeMapping.AnsiTypeMapping 16.81% 20 119
com.clickhouse.jdbc.JdbcTypeMapping.InstanceHolder 100.00% 3 3
com.clickhouse.jdbc.JdbcWrapper 20.00% 1 5
com.clickhouse.jdbc.Main 0.00% 60
com.clickhouse.jdbc.Main.GenericQuery 0.00% 114
com.clickhouse.jdbc.Main.Int8Query 0.00% 59
com.clickhouse.jdbc.Main.MixedQuery 0.00% 89
com.clickhouse.jdbc.Main.Options 0.00% 124
com.clickhouse.jdbc.Main.Pojo 0.00% 25
com.clickhouse.jdbc.Main.StringQuery 0.00% 57
com.clickhouse.jdbc.Main.UInt64Query 0.00% 57
com.clickhouse.jdbc.parser.AbstractCharStream 44.44% 88 198
com.clickhouse.jdbc.parser.ClickHouseSqlParser 68.85% 2816 4090
com.clickhouse.jdbc.parser.ClickHouseSqlParserConstants 100.00% 1 1
com.clickhouse.jdbc.parser.ClickHouseSqlParserTokenManager 76.47% 1456 1904
com.clickhouse.jdbc.parser.ClickHouseSqlStatement 69.93% 100 143
com.clickhouse.jdbc.parser.ClickHouseSqlUtils 100.00% 28 28
com.clickhouse.jdbc.parser.LanguageType 100.00% 6 6
com.clickhouse.jdbc.parser.OperationType 100.00% 2 2
com.clickhouse.jdbc.parser.ParseException 3.95% 3 76
com.clickhouse.jdbc.parser.ParseHandler 75.00% 3 4
com.clickhouse.jdbc.parser.SimpleCharStream 30.00% 9 30
com.clickhouse.jdbc.parser.StatementType 97.30% 36 37
com.clickhouse.jdbc.parser.Token 66.67% 8 12
com.clickhouse.jdbc.parser.TokenMgrException 0.00% 39
com.clickhouse.jdbc.SqlExceptionUtils 50.00% 31 62

@github-actions
Copy link
Copy Markdown

Client V1 Coverage

Coverage Report

Package Coverage Lines Covered Total Lines
com.clickhouse.client 51.66% 2097 4059
com.clickhouse.client.config 70.57% 199 282
com.clickhouse.client.naming 86.96% 20 23
Class Coverage
Class Coverage Lines Covered Total Lines
com.clickhouse.client.AbstractClient 63.93% 78 122
com.clickhouse.client.AbstractSocketClient 3.13% 7 224
com.clickhouse.client.AbstractSocketClient.SocketRequest 0.00% 8
com.clickhouse.client.ClickHouseClient 6.16% 17 276
com.clickhouse.client.ClickHouseClientBuilder 68.67% 57 83
com.clickhouse.client.ClickHouseClientBuilder.Agent 19.05% 28 147
com.clickhouse.client.ClickHouseClientBuilder.DummyClient 53.85% 7 13
com.clickhouse.client.ClickHouseCluster 40.98% 25 61
com.clickhouse.client.ClickHouseConfig 80.93% 208 257
com.clickhouse.client.ClickHouseConfig.ClientOptions 66.67% 14 21
com.clickhouse.client.ClickHouseCredentials 60.00% 18 30
com.clickhouse.client.ClickHouseDnsResolver 41.67% 5 12
com.clickhouse.client.ClickHouseException 74.58% 44 59
com.clickhouse.client.ClickHouseLoadBalancingPolicy 67.06% 57 85
com.clickhouse.client.ClickHouseLoadBalancingPolicy.DefaultPolicy 100.00% 2 2
com.clickhouse.client.ClickHouseLoadBalancingPolicy.FirstAlivePolicy 95.24% 20 21
com.clickhouse.client.ClickHouseLoadBalancingPolicy.RandomPolicy 100.00% 6 6
com.clickhouse.client.ClickHouseLoadBalancingPolicy.RoundRobinPolicy 92.86% 13 14
com.clickhouse.client.ClickHouseNode 80.45% 284 353
com.clickhouse.client.ClickHouseNode.Builder 66.67% 68 102
com.clickhouse.client.ClickHouseNode.Status 100.00% 5 5
com.clickhouse.client.ClickHouseNodes 53.87% 202 375
com.clickhouse.client.ClickHouseNodeSelector 88.64% 78 88
com.clickhouse.client.ClickHouseParameterizedQuery 76.32% 174 228
com.clickhouse.client.ClickHouseParameterizedQuery.QueryPart 62.50% 15 24
com.clickhouse.client.ClickHouseProtocol 97.06% 33 34
com.clickhouse.client.ClickHouseRequest 55.84% 330 591
com.clickhouse.client.ClickHouseRequest.Mutation 83.33% 90 108
com.clickhouse.client.ClickHouseRequest.PipedWriter 100.00% 7 7
com.clickhouse.client.ClickHouseRequestManager 0.00% 22
com.clickhouse.client.ClickHouseRequestManager.InstanceHolder 0.00% 2
com.clickhouse.client.ClickHouseResponse 18.18% 2 11
com.clickhouse.client.ClickHouseResponse.new ClickHouseResponse() {...} 33.33% 3 9
com.clickhouse.client.ClickHouseResponseSummary 85.00% 51 60
com.clickhouse.client.ClickHouseResponseSummary.Progress 92.00% 23 25
com.clickhouse.client.ClickHouseResponseSummary.Statistics 64.71% 11 17
com.clickhouse.client.ClickHouseSimpleResponse 48.57% 34 70
com.clickhouse.client.ClickHouseSslContextProvider 90.91% 10 11
com.clickhouse.client.ClickHouseStreamResponse 0.00% 47
com.clickhouse.client.ClickHouseTransaction 0.00% 220
com.clickhouse.client.ClickHouseTransaction.XID 0.00% 35
com.clickhouse.client.ClickHouseTransactionException 0.00% 11
com.clickhouse.client.ClickHouseVersionUtils 44.65% 71 159
com.clickhouse.client.config.ClickHouseClientOption 89.61% 138 154
com.clickhouse.client.config.ClickHouseDefaults 94.44% 34 36
com.clickhouse.client.config.ClickHouseDefaultSslContextProvider 24.69% 20 81
com.clickhouse.client.config.ClickHouseDefaultSslContextProvider.NonValidatingTrustManager 0.00% 4
com.clickhouse.client.config.ClickHouseHealthCheckMethod 100.00% 3 3
com.clickhouse.client.config.ClickHouseProxyType 100.00% 2 2
com.clickhouse.client.config.ClickHouseSslMode 100.00% 2 2
com.clickhouse.client.naming.SrvResolver 86.96% 20 23
com.clickhouse.client.UnsupportedProtocolException 0.00% 4

@mshustov
Copy link
Copy Markdown
Member

mshustov commented Apr 5, 2026

@claude[agent] review changes

@Claude
Copy link
Copy Markdown

Claude AI commented Apr 5, 2026

@claude[agent] review changes

Code Review: Geometry Type Support

I've reviewed the changes implementing Geometry alias type support. Here are my findings:

Summary

This PR adds support for ClickHouse's Geometry type alias, which is a variant type containing Point, Ring, LineString, MultiLineString, Polygon, and MultiPolygon. The implementation includes:

  • Binary read/write support in client-v2
  • String conversion for JDBC/display purposes
  • JDBC mapping additions
  • Test coverage for read/write operations

Findings

CRITICAL: Missing null handling in array dimension detection

Location: SerializerUtils.java:729-730 and DataTypeConverter.java:getArrayDimensions()

The getArrayDimensions() helper has hardcoded fast paths for primitive arrays (e.g., double[]) but falls back to reflection for generic cases. However, the null-checking order is inconsistent:

  • In SerializerUtils.getArrayDimensions(): checks null after instanceof checks for primitive arrays (line 751)
  • In DataTypeConverter.getArrayDimensions(): doesn't check for null at all before calling .getClass().isArray()

Impact: NPE risk if null values are passed, especially in the DataTypeConverter version.

Recommendation: Add explicit null checks at the beginning of both methods.


MEDIUM: Inconsistent type mapping between read and write paths

Location: ClickHouseColumn.java:337-349

The createGeometryVariantColumn() creates a mapping that includes 4 geometry types (Point, Ring, Polygon, MultiPolygon) based on dimensions 1-4:

map.put(1, getVariantOrdNum(column.nested, ClickHouseDataType.Point));
map.put(2, getVariantOrdNum(column.nested, ClickHouseDataType.Ring));
map.put(3, getVariantOrdNum(column.nested, ClickHouseDataType.Polygon));
map.put(4, getVariantOrdNum(column.nested, ClickHouseDataType.MultiPolygon));

However, the underlying variant definition includes 6 types: Variant(Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon)

Question: How do users write LineString or MultiLineString values? The dimension-based mapping doesn't distinguish between:

  • Ring (Array(Point)) vs LineString (Array(Point)) - both are 2D arrays
  • Polygon (Array(Ring)) vs MultiLineString (Array(LineString)) - both are 3D arrays

Impact: Users cannot explicitly write LineString or MultiLineString geometries. The type is always inferred as Ring or Polygon for 2D/3D arrays respectively.

Recommendation: Document this limitation or add a way to specify the exact geometry type (e.g., through wrapper objects).


MEDIUM: Geometry type handling assumes double arrays

Location: SerializerUtils.getArrayDimensions() lines 743-750

The fast path checks explicitly for double[] and Double[] arrays:

if (value instanceof double[] || value instanceof Double[]) {
    return 1;
}

This is correct for ClickHouse geometry types (which use Float64 = Double), but the error messages and the fallback to generic array dimension counting could be confusing if a user passes int[][] or other numeric array types.

Impact: Error messages won't clearly explain why int[][] can't be written to a Geometry column.

Recommendation: Consider adding validation that rejects non-double array types with a clearer error message.


LOW: Inconsistent raw cast warnings

Location: ClickHouseColumn.java:106

Added @SuppressWarnings("deprecation") to the entire class, but the changes only affect a few methods. The deprecation warning appears unrelated to the Geometry implementation.

Question: Is this suppression related to your changes, or was it accidentally included?


LOW: Code duplication in DataTypeConverter

Location: DataTypeConverter.java:244-293

The getArrayDimensions() method is nearly identical to the one in SerializerUtils.java:742-772, but with slight differences:

  • SerializerUtils version has more detailed null handling
  • Return values and logic are the same

Impact: Maintenance burden - bug fixes need to be applied twice.

Recommendation: Consider extracting to a shared utility class or referencing one implementation from the other.


LOW: String formatting for Geometry values

Location: DataTypeConverter.java:290-320

The geoArrayToString() method formats geometry as (1.0,2.0) for points and [(1.0,2.0),(3.0,4.0)] for higher dimensions.

Question: Is this output format stable and intentional? It differs from standard geometric formats like WKT (Well-Known Text). If this is part of the user-visible API (getString() in JDBC), it should be documented as the canonical textual representation.

Impact: Users may depend on this format for parsing or display.


Compatibility Assessment

No breaking changes detected

The changes are additive:

  • New Geometry enum value added to ClickHouseDataType
  • New helper methods added to existing classes
  • Existing type handling logic extended with new case branches
  • No changes to public method signatures, return types, or existing type mappings

Test Coverage

Good coverage for read/write operations

  • DataTypeTests.testGeometryReadFromTable() covers reading from table
  • DataTypeTests.testGeometryWriteToTable() covers writing to table
  • Both tests cover 1D-4D geometry arrays (Point, Ring/LineString, Polygon/MultiLineString, MultiPolygon)
  • Tests use both primitive (double[]) and boxed (Double[]) arrays

⚠️ Missing test coverage:

  • Null value handling in Geometry columns
  • Error cases (wrong array types, mismatched dimensions)
  • JDBC getString() output format validation
  • Edge cases: empty arrays, single-element arrays

Documentation

⚠️ No documentation updates

docs/features.md should be updated to document:

  • That Geometry type is supported in client-v2 and jdbc-v2
  • How dimension-based type inference works (double[] → Point, double[][] → Ring, etc.)
  • That LineString/MultiLineString cannot be explicitly distinguished from Ring/Polygon
  • The canonical string format for geometry values

Final Assessment

Summary: The implementation is functionally correct for the common case (double arrays of 1-4 dimensions) and integrates well with the existing variant-type infrastructure. The main concerns are around null safety, the limitation of dimension-based type inference, and missing documentation.

Compatibility risk: Low - changes are additive and follow existing patterns.

Tests: Core read/write paths are tested. Edge cases and error paths need coverage.

Docs: Should update docs/features.md to document the new Geometry type support and its limitations.

Recommended actions before merge:

  1. Fix null handling in DataTypeConverter.getArrayDimensions()
  2. Document the dimension-based type inference limitation (LineString/MultiLineString)
  3. Add focused tests for null values and error cases
  4. Consider consolidating duplicated getArrayDimensions() logic

@Claude Claude AI changed the title [client-v2] Added support of Geometry alias type Addressing PR comments Apr 5, 2026
@Claude Claude AI requested a review from mshustov April 5, 2026 07:44
@chernser chernser changed the title Addressing PR comments [client-v2,jdbc-v2] Support Geometry Type Apr 6, 2026
@chernser chernser marked this pull request as ready for review April 6, 2026 20:57
@chernser chernser requested a review from mzitnik as a code owner April 6, 2026 20:57
@chernser
Copy link
Copy Markdown
Contributor Author

@claude review

@claude
Copy link
Copy Markdown

claude Bot commented Apr 23, 2026

Claude finished @chernser's task in 5m 31s —— View job


Code Review: Geometry Type Support

Tasks:

  • Initialize review
  • Read CLAUDE.md, AGENTS.md, and review guidelines
  • Review changed files
  • Post comprehensive review

Review Findings

Ordered by severity, focusing on bugs, regressions, and compatibility risk.


Bug: NPE in getGeometryVariantOrdNum(Object value)ClickHouseColumn.java:920

public int getGeometryVariantOrdNum(Object value) {
    if (value == null) { return -1; }
    Integer ordNum = classToVariantOrdNumMap.get(value.getClass()); // NPE here
    ...
}

classToVariantOrdNumMap is only initialized for Variant and Geometry columns. For any other column type it remains null. This method is public, so it can be called on any ClickHouseColumn instance. If called on a non-Geometry/non-Variant column, it throws NullPointerException at the .get() call.

In practice, serializerGeometry is the only caller today and always uses a Geometry column — but the public visibility makes this a latent breakage risk. A null guard at the top would close it:

if (classToVariantOrdNumMap == null) return -1;

Fix this →


Bug: NPE in serializerGeometry error path for null value — SerializerUtils.java:737-739

} else {
    throw new IllegalArgumentException(
        "Cannot write value of class " + value.getClass() + ...); // NPE if value is null
}

When value is null: getGeometryVariantOrdNum(null) returns -1, the second condition value != null && ... is false, typeOrdNum remains -1, and the error path calls value.getClass() on a null reference.

Compare to serializerVariant — it has the same structural issue, but Geometry is new code where this can be fixed. Fix: (value == null ? "null" : value.getClass().getName()).

Fix this →


Medium: tryGeoToString silently treats 2-element double arrays in Dynamic columns as geo points — DataTypeConverter.java:264-270

if (dataType == ClickHouseDataType.Dynamic) {
    return geoArrayToString(value); // fires for ANY double[]{x, y} in a Dynamic column
}

isGeoShape validates structure (exactly 2 elements at depth 1) but not semantics. Any double[]{a, b} stored in a Dynamic column — e.g., a 2D coordinate that isn't a geo point — will now be formatted as (a,b) via geoArrayToString instead of whatever string representation it had before. This is a behavior change for Dynamic column getString() calls that did not contain geometry.

If this is intentional, it should be noted. If not, restrict the Dynamic case to values retrieved from columns already identified as Geometry or from variants that include geo types.


Medium: LineString and MultiLineString cannot be explicitly written through Geometry columns — ClickHouseColumn.java:343-347

map.put(1, getVariantOrdNum(column.nested, ClickHouseDataType.Point));
map.put(2, getVariantOrdNum(column.nested, ClickHouseDataType.Ring));       // not LineString
map.put(3, getVariantOrdNum(column.nested, ClickHouseDataType.Polygon));    // not MultiLineString
map.put(4, getVariantOrdNum(column.nested, ClickHouseDataType.MultiPolygon));

The Geometry variant definition is Variant(Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon), but the dimension-to-ordinal map only covers 4 of the 6 types. A 2D double array always writes as Ring (ordinal 5 after sort), and a 3D array always writes as Polygon. Users cannot explicitly write a LineString or MultiLineString through the Geometry column.

This appears to be an intentional limitation (since the dimension is ambiguous), but it is not documented anywhere. It should be called out in docs/features.md or at least in a code comment.


Medium: docs/features.md not updated

Per docs/ai-review.md and CLAUDE.md, when a new user-visible feature is added to client-v2 or jdbc-v2, docs/features.md should be updated. This PR introduces:

  • Geometry type read/write support in client-v2
  • Geometry type handling in jdbc-v2
  • A new dimension-based type inference mechanism for Geometry writes
  • A new string format (x,y) / [(x,y),...] for getString() on Geometry values

None of these appear in docs/features.md. The string format is especially important since docs/features.md explicitly calls out getString() formatting as "stable output."


Low: @SuppressWarnings("deprecation") on entire class — ClickHouseColumn.java:57

Added to suppress warnings from referencing ClickHouseDataType.Object (a deprecated constant) at line 71. The suppression is class-wide, which silences deprecation warnings everywhere in the file — including for future code. It should ideally be scoped to the field declaration on line 71 or the specific methods using it.


Low: Changed Geometry enum flags without comment — ClickHouseDataType.java:109

The Geometry enum constant was moved and its metadata flags changed:

  • Old: (false, false, false)parameter=false, caseSensitive=false, signed=false
  • New: (false, true, true)parameter=false, caseSensitive=true, signed=true

The new flags align with sibling types (Ring, LineString, MultiLineString all have (false, true, true)), so this looks like a correction. However, there are no tests that verify these flags for Geometry, and the original values may have been intentional (e.g., if Geometry was always meant to be case-insensitive). A brief comment would clarify intent.


Low: GEOMETRY_VARIANT_COLUMN declared far from usage — ClickHouseColumn.java:936

This static field is used in setupColumnByType at line 312 but declared at line 936 — near the end of the class. Java initializes static fields in declaration order. The field is safe here because createGeometryVariantColumn() creates a Variant column (not Geometry), so no circular initialization occurs. But the placement is unusual and makes the code harder to follow. Conventionally, static constants belong near the top of the class.


Compatibility Assessment

The changes are additive (new enum constant, new methods, new cases in existing switches). No public API signatures were removed or altered. No existing behavior paths were changed. The primary compatibility risks are:

  1. The NPE bugs above (latent, not triggered by current callers)
  2. tryGeoToString behavior change for Dynamic column getString() with 2-element double arrays
  3. The Geometry enum flags change (caseSensitive, signed) — may affect behavior in ClickHouseDataType.match() and name2type lookups

Test Coverage

✅ Integration tests cover round-trip read/write for all four dimension levels (Point, Ring, Polygon, MultiPolygon)
✅ Unit tests in SerializerUtilsTest cover dimension detection, round-trip, and error rejection
testDynamicTypeTagUsesCustomEncodingForGeoTypes validates the binary encoding path

⚠️ Missing tests:

  • Null value in a Geometry column (serialization + deserialization)
  • getString() output format verification for Geometry in JDBC (ResultSetImpl)
  • ClickHouseDataType.Geometry metadata flags (isCaseSensitive(), isSigned())
  • Write of ClickHouseGeoRingValue, ClickHouseGeoPolygonValue, etc. to Geometry (vs. raw arrays)
  • Geometry in arrays: Array(Geometry) read path (the readArrayItem change in BinaryStreamReader)

Summary

What changed: Binary read/write support for Geometry type in client-v2 and JDBC type mapping in jdbc-v2, using a dimension-based write strategy backed by an internal Variant(Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon) column.

Compatibility risk: Low for the additive portions; two NPE bugs exist in the write path for null values; one behavior change in getString() for Dynamic columns.

Tests run: Not run locally (integration tests require a ClickHouse server ≥ 25.10).

Docs: docs/features.md should be updated before merge.

Verdict: need changes — fix the two NPE bugs and update docs/features.md at minimum. The Dynamic column getString() behavior change should be reviewed intentionally.

@chernser chernser marked this pull request as draft April 23, 2026 17:56
@sonarqubecloud
Copy link
Copy Markdown

@chernser
Copy link
Copy Markdown
Contributor Author

chernser commented May 5, 2026

@claude review

@claude
Copy link
Copy Markdown

claude Bot commented May 5, 2026

Claude finished @chernser's task in 4m 37s —— View job


Code Review: Geometry Type Support

Tasks:

  • Initialize review
  • Read CLAUDE.md, AGENTS.md, and review guidelines
  • Review changed files
  • Post comprehensive review

Status of Previous Findings

Issues from the two prior reviews were largely addressed:

  • ✅ NPE in getGeometryVariantOrdNum(Object) when classToVariantOrdNumMap is null — fixed (ClickHouseColumn.java:916)
  • ✅ NPE in serializerGeometry error-path message when value is null — fixed (SerializerUtils.java:742)
  • docs/features.md updated with Geometry support, dimension-based inference, and the Ring/LineString ambiguity limitation
  • List<> write support added for Geometry columns

Findings

Medium: Point element validation is more permissive in the write path than in the string path — inconsistent behavior across round-trip

Write pathSerializerUtils.isValidGeometryShape (SerializerUtils.java:809-811):

return getGeometryLength(value) == 2
    && getGeometryElement(value, 0) instanceof Number
    && getGeometryElement(value, 1) instanceof Number;

String pathDataTypeConverter.isGeoShape (DataTypeConverter.java:326-328):

return Array.getLength(value) == 2
    && Array.get(value, 0) instanceof Double
    && Array.get(value, 1) instanceof Double;

The write path accepts any Number subtype (e.g., float[], int[]) as a valid point shape, dispatches to the Point variant ordinal, and then calls serializeTupleData which attempts to write each element as Float64. What actually happens at serializeTupleData for an int element is an implicit numeric coercion that may silently truncate or fail.

The string path requires boxed Double specifically, so a float[] value written to a Geometry column may serialize without error but produce no geo-formatted string on getString().

Recommendation: Align isValidGeometryShape to require the innermost elements to be Double (or double — which is already handled by the fast-path instanceof checks) for consistency, or add an explicit type-validation error at the point where a non-Float64 value is passed to a Point-typed variant.

Fix this →


Medium: tryGeoToString formats any valid-shaped Double[] array stored in a Dynamic column as geo — unintended behavior change

DataTypeConverter.java:268-270:

if (dataType == ClickHouseDataType.Dynamic) {
    return geoArrayToString(value);
}

isGeoShape validates structure (exactly 2 Double elements at depth 1, recursive arrays at higher depths), but any Double[]{a, b} in a Dynamic column — including a 2-element coordinate pair that is not a geo point — will now be rendered as (a,b) instead of a plain array string. This is a behavior change for getString() on Dynamic columns with 2-element double arrays that are not geometry.

The Variant branch handles this correctly by checking whether the variant's nested types include a geo type (matchesGeoVariant). The Dynamic branch should apply similar intent — it can only use geo formatting when there is contextual evidence the value is geometric (e.g., the variant type tag is checked on read, so the value returned from readVariant is already typed).

Recommendation: Remove the unconditional Dynamic branch or gate it on a geo-specific marker available at read time (e.g., check whether the value was tagged as a geo type during deserialization).


Low: Double traversal of geometry values on each write

serializerGeometry (SerializerUtils.java:729-746):

  1. getArrayDimensions(value) — O(depth) traversal to count dimensions
  2. isValidGeometryShape(value, dimensions) — O(n) full tree traversal to validate structure
  3. serializeData(out, value, ...) — O(n) full tree traversal to serialize

For large multi-polygon geometries (thousands of points), steps 2 and 3 both traverse the full structure. The validation in step 2 is repeated for every row in an insert.

Recommendation: For the common fast path (primitive double[], double[][], etc.), the existing early instanceof checks already skip the full traversal. For the generic List<> and Object[] paths, consider combining validation and serialization, or at least computing the structure metrics in a single pass. Not a blocking issue but a performance improvement for bulk inserts.


Low: getVariantOrdNum throws for empty or null-first-element List — pre-existing but exposed by new code

ClickHouseColumn.java:879-880:

Object tmpV = ((List<?>) value).get(0);   // IndexOutOfBoundsException if list is empty
Class<?> valueClass = tmpV.getClass();    // NPE if first element is null

This is in the Variant write path, not the Geometry-specific path (Geometry uses getGeometryVariantOrdNum). Pre-existing before this PR. However, this code path is now more exercised since Geometry columns have a Variant backing structure, and the getVariantOrdNum method is part of the same class. A guard against an empty or all-null list would prevent the exception from appearing in an unexpected context.


Low: @SuppressWarnings("deprecation") still applied class-wide — ClickHouseColumn.java:57

The annotation silences warnings for the entire file. It was added to suppress use of ClickHouseDataType.Object (deprecated since CH 25.11) at line 71. Scoping it to the specific field declaration or the relevant method would avoid hiding future deprecation introductions.


Compatibility Assessment

The changes are additive — no existing public API signatures, serialized outputs, or documented behaviors were removed or altered. The primary compatibility-sensitive addition is ClickHouseDataType.Geometry now dispatching to a Variant-backed binary path rather than treating it as a String alias. This is the correct change for CH 25.11+.

The tryGeoToString behavior change for Dynamic columns (discussed above) is the main observable regression risk for existing callers using getString() on Dynamic columns with 2-element double arrays.

Test Coverage

✅ Unit round-trip tests for all four geometry dimensions (Point, Ring, Polygon, MultiPolygon) via arrays
✅ Unit round-trip tests for List<Double> and List<List<List<Double>>> shapes
✅ Array dimension detection unit tests including null, empty, and Object[] with nested types
✅ Rejection tests for unsupported values and malformed lists
✅ Integration tests for read and write through a real Geometry column
✅ Dynamic column geo type tagging verified
docs/features.md updated with supported types, dimension inference, and write ambiguity

⚠️ No test for writing a non-Double numeric array (e.g., new float[]{1f, 2f}) to a Geometry column — unclear whether this silently writes wrong data or fails with a useful error
⚠️ No test for getString() / JDBC ResultSet.getString() output format on a Geometry value
⚠️ No test for getVariantOrdNum with an empty or null-first-element List<>

Verdict

ready for human review — the critical NPE bugs from the prior review are fixed, the feature contract is documented, and List write support was added. The remaining issues (inconsistent point-element type validation, Dynamic column getString() behavior change, and the minor test gaps) should be addressed before merge or tracked as follow-up issues.

@chernser chernser marked this pull request as ready for review May 5, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[client-v2] Add new Geometry type

3 participants