Skip to content

Commit a504d68

Browse files
committed
fixed
1 parent 8b39570 commit a504d68

6 files changed

Lines changed: 4 additions & 47 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
### New Features
3131

32-
- **[client-v2]** Added `Session` API to encapsulate and manage ClickHouse session settings (`session_id`, `session_check`, `session_timeout`, `session_timezone`) as a reusable object. The `Session` instance can be applied to any request settings using `applyTo()`, and session state can be cleared via `clearSession()`. Additionally, added `resetOption(String)` and `suppressOption(String)` to `InsertSettings`, `QuerySettings`, and `CommonSettings` to allow removing or suppressing specific settings. Suppressed settings (set to `null`) will not be sent to the server, which is useful for overriding global settings.
32+
- **[client-v2]** Added `Session` API to encapsulate and manage ClickHouse session settings (`session_id`, `session_check`, `session_timeout`, `session_timezone`) as a reusable object. The `Session` instance can be applied to any request settings using `applyTo()`, and session state can be cleared via `clearSession()`. Additionally, added `resetOption(String)` to `InsertSettings`, `QuerySettings`, and `CommonSettings` to allow removing specific settings. Settings explicitly set to `null` will not be sent to the server, which is useful for overriding global settings.
3333

3434
- **[client-v2]** Added runtime credential update APIs on `Client`: `updateUserAndPassword(String, String)`, `updateAccessToken(String)`, and `updateBearerToken(String)`. Subsequent requests on the same `Client` instance use the new credentials without rebuilding the client. The authentication method is fixed at construction time; calling a runtime updater that does not match the configured method throws `ClientMisconfigurationException`. See `docs/authentication.md` for details and migration guidance.
3535

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.clickhouse.client.api.http.ClickHouseHttpProto;
44
import com.clickhouse.client.api.internal.ValidationUtils;
55

6-
import java.util.HashMap;
76
import java.util.Map;
87

98
/**
@@ -93,7 +92,7 @@ public synchronized void applyTo(Map<? super String, Object> requestSettings) {
9392
putIfSet(requestSettings, ClickHouseHttpProto.QPARAM_SESSION_TIMEZONE, sessionTimezone);
9493
}
9594

96-
public static void clearSession(HashMap<String, Object> settings) {
95+
public static void clearSession(Map<String, Object> settings) {
9796
settings.put(ClientConfigProperties.serverSetting(ClickHouseHttpProto.QPARAM_SESSION_ID), null);
9897
settings.put(ClientConfigProperties.serverSetting(ClickHouseHttpProto.QPARAM_SESSION_TIMEOUT), null);
9998
settings.put(ClientConfigProperties.serverSetting(ClickHouseHttpProto.QPARAM_SESSION_CHECK), null);

client-v2/src/main/java/com/clickhouse/client/api/insert/InsertSettings.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,6 @@ public InsertSettings resetOption(String option) {
6969
return this;
7070
}
7171

72-
/**
73-
* Makes option value to null that makes agent to remove it from final collection.
74-
* This is useful to override even global settings when they need to be removed.
75-
* @param option - option key
76-
* @return current settings instance
77-
*/
78-
public InsertSettings suppressOption(String option) {
79-
settings.suppressOption(option);
80-
return this;
81-
}
82-
8372
/**
8473
* Get all settings as an unmodifiable map.
8574
*

client-v2/src/main/java/com/clickhouse/client/api/internal/CommonSettings.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CommonSettings {
2020

2121
private String operationId;
2222
private String logComment;
23-
protected HashMap<String, Object> settings; // using hashmap to store null values
23+
protected Map<String, Object> settings;
2424

2525
public CommonSettings() {
2626
settings = new HashMap<>();
@@ -66,27 +66,11 @@ public CommonSettings setOption(String option, Object value) {
6666
return this;
6767
}
6868

69-
/**
70-
* Removes option from the setting
71-
* @param option - option key
72-
* @return current settings instance
73-
*/
7469
public CommonSettings resetOption(String option) {
7570
settings.remove(option);
7671
return this;
7772
}
7873

79-
/**
80-
* Makes option value to null that makes agent to remove it from final collection.
81-
* This is useful to override even global settings when they need to be removed.
82-
* @param option - option key
83-
* @return current settings instance
84-
*/
85-
public CommonSettings suppressOption(String option) {
86-
settings.put(option, null);
87-
return this;
88-
}
89-
9074
/**
9175
* Get all settings as an unmodifiable map.
9276
*

client-v2/src/main/java/com/clickhouse/client/api/query/QuerySettings.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,11 @@ public QuerySettings setOption(String option, Object value) {
5050
return this;
5151
}
5252

53-
/**
54-
* Removes options from the settings.
55-
* @param option - configuration option name
56-
*/
5753
public QuerySettings resetOption(String option) {
5854
settings.resetOption(option);
5955
return this;
6056
}
6157

62-
/**
63-
* Makes option value to null that makes agent to remove it from final collection.
64-
* This is useful to override even global settings when they need to be removed.
65-
* @param option - option key
66-
* @return current settings instance
67-
*/
68-
public QuerySettings suppressOption(String option) {
69-
settings.suppressOption(option);
70-
return this;
71-
}
72-
7358
/**
7459
* Gets a configuration option.
7560
*

docs/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This document lists stable, user-visible behavior in `client-v2` and `jdbc-v2` t
1111
- Proxy support: Can send requests through configured HTTP proxies, including proxy credentials.
1212
- Connection and socket tuning: Exposes pool sizing, keep-alive, reuse strategy, connect/request/socket timeouts, and low-level socket options.
1313
- Query execution: Executes SQL asynchronously and returns streaming query responses with response metadata and metrics.
14-
- Query settings: Supports per-query database selection, output format, execution limits, roles, log comments, headers, reusable `Session` objects, session settings, server settings, and network timeout overrides. Settings explicitly set to `null` are suppressed and will not be sent to the server.
14+
- Query settings: Supports per-query database selection, output format, execution limits, roles, log comments, headers, reusable `Session` objects, session settings, server settings, and network timeout overrides. Settings explicitly set to `null` will not be sent to the server.
1515
- Parameterized SQL: Accepts named query parameters and can send them through supported HTTP request encodings.
1616
- Result materialization helpers: Provides streaming `Records`, generic row access, and convenience APIs that materialize all rows into generic records or typed POJOs.
1717
- Binary format readers: Reads ClickHouse binary result formats including `Native`, `RowBinary`, `RowBinaryWithNames`, and `RowBinaryWithNamesAndTypes`.

0 commit comments

Comments
 (0)