Skip to content

Commit 8e70de8

Browse files
committed
Merge branch 'main' into 04/16/26/jdbc_override_settings
2 parents 5d4d7e4 + dd49525 commit 8e70de8

25 files changed

Lines changed: 1034 additions & 21 deletions

File tree

.github/workflows/claude.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
github.event.sender.type != 'Bot' &&
17+
(
18+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) ||
19+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association) ||
20+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)
21+
) &&
22+
(
23+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
24+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
25+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
26+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
27+
)
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
issues: write
33+
id-token: write
34+
actions: read # Required for Claude to read CI results on PRs
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38+
with:
39+
fetch-depth: 1
40+
41+
- name: Run Claude Code
42+
id: claude
43+
uses: anthropics/claude-code-action@b47fd721da662d48c5680e154ad16a73ed74d2e0 # v1
44+
with:
45+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
46+
47+
# This is an optional setting that allows Claude to read CI results on PRs
48+
additional_permissions: |
49+
actions: read
50+
51+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
52+
# prompt: 'Update the pull request description to include a summary of changes.'
53+
54+
# Optional: Add claude_args to customize behavior and configuration
55+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
56+
# or https://code.claude.com/docs/en/cli-reference for available options
57+
# claude_args: '--allowed-tools Bash(gh pr:*)'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Relay bugs for cross-repo investigation
2+
3+
# Relays newly-opened issues to ClickHouse/integrations-ai-playground for
4+
# cross-repo investigation.
5+
6+
on:
7+
issues:
8+
types: [opened]
9+
10+
permissions: {}
11+
12+
jobs:
13+
relay:
14+
uses: ClickHouse/integrations-shared-workflows/.github/workflows/cross-repo-bug-relay.yml@main
15+
secrets:
16+
WORKFLOW_AUTH_PUBLIC_APP_ID: ${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}
17+
WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY: ${{ secrets.WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY }}

CHANGELOG.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

33
### Breaking Changes
44

5-
- **[jdbc-v2]** Hardcoded server setting `async_insert=0` is removed as well as others. This is done to
6-
fix issue with overriding these settings and using client with read-only profiles. The change, first of all, makes
7-
driver behavior to follow default what is set on server side (note: starting ClickHouse 26.3 `async_insert` is on by default).
8-
In second, this fix changes what number of affected rows returned by method like `java.sql.Statement.executeUpdate(java.lang.String)`.
9-
Previously they return more accurate values because insert was synchronous, but in case of asynchronous insert it is not
10-
guaranteed anymore (see also https://github.com/ClickHouse/ClickHouse/issues/57768). Read more about asynchronous insert https://clickhouse.com/docs/optimize/asynchronous-inserts.
11-
(https://github.com/ClickHouse/clickhouse-java/issues/2652, https://github.com/ClickHouse/clickhouse-java/issues/2825)
5+
- **[jdbc-v2]** Hardcoded server setting `async_insert=0` is removed as well as others. This is done to
6+
fix issue with overriding these settings and using client with read-only profiles. The change, first of all, makes
7+
driver behavior to follow default what is set on server side (note: starting ClickHouse 26.3 `async_insert` is on by default).
8+
In second, this fix changes what number of affected rows returned by method like `java.sql.Statement.executeUpdate(java.lang.String)`.
9+
Previously they return more accurate values because insert was synchronous, but in case of asynchronous insert it is not
10+
guaranteed anymore (see also https://github.com/ClickHouse/ClickHouse/issues/57768). Read more about asynchronous insert https://clickhouse.com/docs/optimize/asynchronous-inserts.
11+
(https://github.com/ClickHouse/clickhouse-java/issues/2652, https://github.com/ClickHouse/clickhouse-java/issues/2825)
12+
13+
### New Features
14+
15+
- **[jdbc-v2]** Added `cluster_name` configuration property to specify a target cluster for statements like `KILL QUERY` that require an `ON CLUSTER` clause to execute across all nodes. (https://github.com/ClickHouse/clickhouse-java/issues/2837)
16+
17+
### Bug Fixes
18+
19+
- **[client-v2]** Fixed inconsistent use of `executionTimeout` parameter in `Client` component. The timeout was previously set in milliseconds but mistakenly retrieved and used in seconds in some places. Now it correctly uses milliseconds consistently. (https://github.com/ClickHouse/clickhouse-java/issues/2358)
1220

1321
## 0.9.8
1422

clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/GenericJDBCTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void connectionTest() throws SQLException {
3131
}
3232
}
3333

34-
@Test
34+
@Test(enabled = false) // skipped to be removed after reviewing tests.
3535
public void connectionWithPropertiesTest() throws SQLException {
3636
Properties properties = new Properties();
3737
properties.setProperty("user", "default");

client-v2/src/main/java/com/clickhouse/client/api/Client.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,12 @@ public Builder setProxyCredentials(String user, String pass) {
667667
}
668668

669669
/**
670-
* Sets the maximum time for operation to complete. By default, it is set to 3 hours.
671-
* @param timeout
672-
* @param timeUnit
673-
* @return
670+
* Sets the maximum time for operation to complete. By default, it is unlimited.
671+
* Value is saved in milliseconds always.
672+
*
673+
* @param timeout value of the timeout
674+
* @param timeUnit time unit of the timeout value
675+
* @return this instance
674676
*/
675677
public Builder setExecutionTimeout(long timeout, ChronoUnit timeUnit) {
676678
this.configuration.put(ClientConfigProperties.MAX_EXECUTION_TIME.getKey(), String.valueOf(Duration.of(timeout, timeUnit).toMillis()));
@@ -1958,10 +1960,10 @@ private TableSchema getTableSchemaImpl(
19581960
QuerySettings settings = new QuerySettings().setDatabase(database);
19591961
try (QueryResponse response = operationTimeout == 0
19601962
? query(describeQuery, queryParams, settings).get()
1961-
: query(describeQuery, queryParams, settings).get(getOperationTimeout(), TimeUnit.SECONDS)) {
1963+
: query(describeQuery, queryParams, settings).get(operationTimeout, TimeUnit.MILLISECONDS)) {
19621964
return TableSchemaParser.readTSKV(response.getInputStream(), name, originalQuery, database);
19631965
} catch (TimeoutException e) {
1964-
throw new ClientException("Operation has likely timed out after " + getOperationTimeout() + " seconds.", e);
1966+
throw new ClientException("Operation has likely timed out after " + getOperationTimeout() + " milliseconds.", e);
19651967
} catch (ExecutionException e) {
19661968
throw new ClientException("Failed to get table schema", e.getCause());
19671969
} catch (ServerException e) {
@@ -2118,7 +2120,10 @@ public Map<String, String> getConfiguration() {
21182120
return readOnlyConfig;
21192121
}
21202122

2121-
/** Returns operation timeout in seconds */
2123+
/**
2124+
* Returns operation ({@link ClientConfigProperties#MAX_EXECUTION_TIME}) timeout value in milliseconds.
2125+
* @return timeout value in milliseconds.
2126+
*/
21222127
protected int getOperationTimeout() {
21232128
return ClientConfigProperties.MAX_EXECUTION_TIME.getOrDefault(configuration);
21242129
}

docs/ai-review.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Use this guide across Cursor, Claude, Copilot, and other AI assistants when revi
44

55
This repository contains Java libraries and drivers for ClickHouse, including shared data types, HTTP clients, the v2 client, JDBC drivers, and R2DBC integration.
66

7+
For a reusable review write-up format, use `docs/review-template.md`.
8+
79
## Role
810

911
Act as an experienced maintainer and reviewer of a public Java library.
@@ -169,6 +171,8 @@ When responding to a review request:
169171
3. Use file or symbol references where helpful.
170172
4. Keep any change summary brief and secondary.
171173
5. If no issues are found, say so explicitly and mention residual risk or testing gaps.
174+
6. Use `docs/review-template.md` when a structured review summary is helpful.
175+
7. End with exactly one verdict: `ready to merge`, `ready for human review`, or `need changes`.
172176

173177
In the final summary, state:
174178

docs/features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Compatibility-sensitive traits:
4949
- Schema and database context: Supports database selection through URL, `setSchema`, `USE`, and statement-level settings.
5050
- Non-transactional operation: Exposes ClickHouse-appropriate transaction behavior with auto-commit semantics and unsupported transactional features.
5151
- Statement execution: Supports `execute`, `executeQuery`, `executeUpdate`, large update counts, and forward-only/read-only statements.
52-
- Query cancellation and timeout: Supports JDBC query timeout handling and query cancellation through server-side `KILL QUERY`.
52+
- Query cancellation and timeout: Supports JDBC query timeout handling and query cancellation through server-side `KILL QUERY`, with optional JDBC `cluster_name` property support to add `ON CLUSTER '<name>'` for cluster-wide cancellation.
5353
- Batch execution: Supports batched statements and prepared-statement batches, including multi-row rewrite for eligible `INSERT ... VALUES` statements.
5454
- Prepared statements: Supports `?` parameters through client-side SQL rendering and validates that all parameters are bound before execution.
5555
- SQL parsing and classification: Classifies SQL to distinguish queries, updates, inserts, `USE`, and role-changing statements, with selectable parser backends.
@@ -67,6 +67,7 @@ Compatibility-sensitive traits:
6767
Compatibility-sensitive traits:
6868

6969
- Prepared statements are client-side SQL rendering, not server-side prepared statements. Changes to literal encoding or placeholder parsing are externally visible behavior.
70+
- JDBC `cluster_name` is compatibility-sensitive for cancellation behavior: when configured, `Statement.cancel()` issues `KILL QUERY ON CLUSTER '<name>'`, and when omitted it falls back to a local `KILL QUERY`.
7071
- String parameters are escaped with backslash-based escaping: backslashes are doubled and single quotes are backslash-escaped before values are wrapped in single quotes.
7172
- `?` placeholder detection is SQL-aware and should not treat question marks inside quoted strings, quoted identifiers, comments, casts, or similar syntax as bind parameters.
7273
- String-like ClickHouse values have stable JDBC expectations: `String`, `FixedString`, and `Enum` values are returned as strings, while `UUID` is available both as `getString()` and `getObject(..., UUID.class)`.

docs/review-template.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Review Template
2+
3+
Use this template when writing a review summary for a pull request or patch.
4+
5+
## Findings
6+
7+
List findings first and order them by severity.
8+
9+
### High
10+
11+
- None.
12+
13+
### Medium
14+
15+
- None.
16+
17+
### Low
18+
19+
- None.
20+
21+
## Human Review Instructions for Important Changes
22+
23+
Ask a human reviewer to inspect important changes directly when the diff touches any of the following:
24+
25+
- public API surface such as public classes, interfaces, methods, constructors, fields, or enums
26+
- behavioral compatibility such as defaults, retries, timeouts, parsing, serialization, formatting, or exception behavior
27+
- JDBC or R2DBC semantics, driver metadata, or type mappings
28+
- documented features in `docs/features.md`
29+
- security-sensitive code, authentication, credentials, or network-facing behavior
30+
- cross-module contracts where the same concept exists in multiple modules
31+
32+
When human review is needed, call out the exact risk and what should be checked, for example:
33+
34+
- verify that no public signature changed
35+
- verify that output format and serialized values are unchanged
36+
- verify that existing callers keep the same default behavior
37+
- verify that focused tests cover compatibility-sensitive paths
38+
- verify whether `docs/features.md` or other docs need updates
39+
40+
## Verdict
41+
42+
Choose exactly one verdict:
43+
44+
- `ready to merge`: no blocking issues found and no additional human sign-off is needed beyond normal review flow
45+
- `ready for human review`: no blocking issues found by AI, but the change is important enough that a human should confirm compatibility, behavior, or product intent
46+
- `need changes`: blocking issues, regressions, compatibility risk, or missing validation were found and should be addressed before merge
47+
48+
## Copy/Paste Template
49+
50+
```md
51+
## Findings
52+
53+
### High
54+
- None.
55+
56+
### Medium
57+
- None.
58+
59+
### Low
60+
- None.
61+
62+
## Human Review Instructions for Important Changes
63+
- None.
64+
65+
## Verdict
66+
`ready to merge`
67+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary
12+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build

0 commit comments

Comments
 (0)