Repository navigation
feat(jdbc-v2): describe each property in Driver#getPropertyInfo - #3358
Conversation
Driver#getPropertyInfo returned a null description for each property that the connection did not set, and "(User Defined)" for each property that had a value, also for driver properties with a default. JDBC tools and IDEs could not explain the properties. The descriptions are now in one bundled resource, com/clickhouse/jdbc/internal/property-descriptions.properties, keyed by the ClientConfigProperties and DriverProperties keys. JdbcConfiguration reads it once. Each client and driver property gets its description; a property that is neither keeps "(User Defined)". Property names, values, defaults and parsing do not change. JdbcConfigurationTest fails when a property has no description or when the resource has a key that is not a property. The integration docs and the changes checklist point to the resource. Implements: #3255 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on 9c8701d. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
…erty-descriptions # Conflicts: # docs/integration-jdbc.md
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
There was a problem hiding this comment.
Auto-approved by the AI review gate on d44ddbe. Details in the approver's comment on this pull request.
chernser
left a comment
There was a problem hiding this comment.
Just realized that it will create another palace we need to update.
Reimplement using pre-processor. Every Driver and Client configuration property should be annotated with @com.clickhouse.client.api.Description annotation containing short useful description of the property, build process then should generate java class that will contain map of this descriptions to near each enum.
In this case we will avoid loading anything from resources and make sure all needed information is present. And complete map can be easily be merged where needed.
…ations Reimplements the property descriptions as the review of #3358 asks: no resource file, the descriptions are next to the properties. - New annotation com.clickhouse.client.api.Description on each constant of ClientConfigProperties and DriverProperties. - New build-only module clickhouse-annotation-processor (not published). Its DescriptionProcessor generates <Enum>Descriptions next to each enum; getDescriptions() returns an unmodifiable EnumMap. A constant without a description, or with a blank one, fails the compilation. - JdbcConfiguration merges the two generated maps by property key. - The java11/java17 compile executions use their own generated-sources directory, so that their rebuild does not delete the sources that the processor generated in default-compile. - The descriptions resource is removed. Implements: #3255 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Generated class: suppress "removal" warnings too, and use java.lang.String so that a type String in the package cannot clash. - clickhouse-annotation-processor compiles with release 8. - JdbcConfiguration.propertyDescriptions() is private. - Tests: no key is both a client and a driver key; literal descriptions of one client and one driver property through getPropertyInfo. - history entry for the new client-v2 API; features.md names the prefixed keys that keep "(User Defined)". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erty-descriptions # Conflicts: # docs/features.md
|
@chernser Done in 0cce12b and c077c85 (head e21ebaa,
Please check two build decisions:
Tests: Size: +737/-3 against |
There was a problem hiding this comment.
Auto-approved by the AI review gate on e21ebaa. Details in the approver's comment on this pull request.
…scription Rename com.clickhouse.client.api.Description to com.clickhouse.client.api.internal.ConfigDescription, so that the annotation is not part of the public API and does not collide with user code. Update the annotation processor, the annotated ClientConfigProperties and DriverProperties constants, the tests, and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on 85443ca. Details in the approver's comment on this pull request.
Summary
Implements #3255.
Driver#getPropertyInfonow returns a description for each client and driver property. Before,DriverPropertyInfo.descriptionwasnullfor a property that the connection did not set, and(User Defined)for a property that had a value. This also applied to driver properties with a default (for examplessl,jdbc_resultset_auto_close), because the driver adds the defaults before it reads the user properties. JDBC tools and IDEs therefore could not explain the properties.Closes #3255
Design
As requested in the review: the descriptions are annotations next to the properties, and the build generates the maps. No resource is loaded.
com.clickhouse.client.api.internal.ConfigDescription(@Target(FIELD),SOURCEretention). Each constant ofClientConfigProperties(69) andDriverProperties(22) has one.clickhouse-annotation-processorwithDescriptionProcessor. For each top-level enum that has@ConfigDescriptionconstants, it generates<Enum>Descriptionsin the package of the enum:ClientConfigPropertiesDescriptions(client-v2) andDriverPropertiesDescriptions(jdbc-v2).getDescriptions()returns an unmodifiableEnumMapin the order of the constants. The generated class has the visibility of the enum.error: Enum constant DriverProperties.SQL_PARSER has no @ConfigDescription.@ConfigDescriptionon a field that is not a constant of a top-level enum also fails.JdbcConfigurationmerges the two maps by property key. Each property thatgetPropertyInforeturns gets its description, whether the connection sets the property or not. A key that is neither a client nor a driver property (for exampleclickhouse_setting_*,http_header_*, or an unknown key) keeps(User Defined).DriverPropertyInfo.choicesandrequiredare not changed (out of the scope of [jdbc-v2] Provide descriptions for Driver.getPropertyInfo configuration entries #3255).socket_keepaliveandsocket_reuseaddr(seesocket_keepalivedoesn't work with shaded clickhouse-jdbc #3092),ssl_key_store,max_threads_per_client. Their descriptions say so. Whensocket_keepalivedoesn't work with shaded clickhouse-jdbc #3092 is fixed, update those two annotations.Build wiring
client-v2andjdbc-v2load the processor throughannotationProcessorPaths(jdbc-v2: indefault-compileonly, so that the test compilation still finds Lombok on the test class path). Amaven-compiler-plugin<dependency>on the processor makes Maven build the module first, also with--also-makeand--threads. The publishedclient-v2andjdbc-v2POMs do not refer to the processor (flatten removes<build>).maven.deploy.skipandexcludeArtifactsofcentral-publishing-maven-pluginin thereleaseprofile. To publish it, remove these two settings.pom.xml: thejava11andjava17compile executions use their owngeneratedSourcesDirectory. Injdbc-v2, the rebuild ofmodule-info.javainjava11deleted theDriverPropertiesDescriptions.javathatdefault-compilegenerated, and thereleaseprofile javadoc then failed.Changes
clickhouse-annotation-processor: new module (DescriptionProcessor, service registration,DescriptionProcessorTest).client-v2:internal.ConfigDescription; annotations onClientConfigProperties;pom.xml.jdbc-v2: annotations onDriverProperties;JdbcConfiguration.propertyDescriptions();pom.xml. The resourceproperty-descriptions.propertiesis removed.pom.xml: new module,excludeArtifacts,generatedSourcesDirectoryofjava11/java17.docs/features.md(client-v2 and jdbc-v2),docs/integration-jdbc.md,docs/clickhouse-docs/jdbc.mdx,docs/changes_checklist.md(a new or changed property needs its@ConfigDescription),AGENTS.md(module list),history/latest/3255.md.Test
DescriptionProcessorTestcompiles sources in memory with only the processor: the generated map (order, escapes of quote, backslash, the text\u0022, line feed, tab, non-ASCII), constants with a body, a deprecated constant without a deprecation warning, a package-private enum, an enum without annotations (no class), and the four compile errors (@DataProvider). Passes on JDK 17 and on JDK 8 (javac8 fromToolProvider).ClientConfigPropertiesTest#testDescriptionsandJdbcConfigurationTest#testDriverPropertiesDescriptions: each constant in order, no blank text, unmodifiable map, and no key that is both a client and a driver key.JdbcConfigurationTest#testGetPropertyInfoDescriptions(@DataProvider, throughDriver#getPropertyInfo): no properties; properties in the URL; properties inProperties. Each property has a non-empty description, client and driver keys get the text of their annotation, unknown and prefixed keys get(User Defined), and the values are unchanged. Two literal checks (user,jdbc_sql_parser) pin the annotation text end to end. It fails when one of the two maps is not merged.mvn -pl clickhouse-annotation-processor,jdbc-v2 test: 8 and 2033 tests, 0 failures.ClientConfigPropertiesTest: 41, 0 failures.DriverTestintegration tests against ClickHouse 26.10: 21, 0 failures.mvn -T 2 clean install -DskipTests;-Prelease package(javadoc of the three modules); build with-Dj8.packages/clickhouse-jdbc-allcontains both generated classes. From the shaded jar,getPropertyInforeturns 92 properties and each has a description, on JDK 8 and JDK 17.Compatibility
descriptionsees text instead ofnull. A property that the application sets shows its description instead of(User Defined); an unknown key still shows(User Defined).ClientConfigPropertiesDescriptionsandDriverPropertiesDescriptions. The annotationConfigDescriptionis in theinternalpackage and hasSOURCEretention, so it is not in the class files.changes_checklist.mdClientConfigPropertiesDescriptions.getDescriptions()andDriverPropertiesDescriptions.getDescriptions()(public, generated, tested);JdbcConfiguration.propertyDescriptions()is package-private.DriverPropertyInfo.description. No SQL, wire format or value changes.@ConfigDescriptionfor a new property; the build enforces it.Checklist
history/latest/3255.md)🤖 Generated with Claude Code
Note
Low Risk
Additive metadata for JDBC tools with no change to property keys, parsing, or connection behavior; new build wiring is isolated to compile time.
Overview
This PR adds user-facing descriptions for JDBC
Driver#getPropertyInfoby annotating everyClientConfigPropertiesandDriverPropertiesconstant with@ConfigDescriptionand generating lookup maps at compile time.A new build-only Maven module
clickhouse-annotation-processorrunsDescriptionProcessor, which emitsClientConfigPropertiesDescriptionsandDriverPropertiesDescriptionswithgetDescriptions(). The build fails if any enum constant lacks a non-blank description or if the annotation is used outside top-level enum constants.client-v2andjdbc-v2wire the processor throughannotationProcessorPaths; the module is excluded from publishing.JdbcConfigurationmerges the generated maps by property key so each known client/driver property gets its description whether or not the connection sets it; unknown keys (e.g.clickhouse_setting_*) still use(User Defined). Property names, defaults, and routing are unchanged—onlyDriverPropertyInfo.descriptionis filled in where it was previouslynullor wrongly(User Defined).Docs,
AGENTS.md,changes_checklist.md, and release notes for #3255 are updated; unit tests cover the processor, generated maps, and end-to-endgetPropertyInfodescriptions.Reviewed by Cursor Bugbot for commit 85443ca. Bugbot is set up for automated code reviews on this repo. Configure here.