Repository navigation
fix(client-v2): keep server time zone as TimeZone in loadServerInfo - #3362
Merged
chernser merged 1 commit intoNov 17, 2026
Merged
Conversation
Client.loadServerInfo() stored the server time zone as a String, but Client.getServerTimeZone() casts the configuration value to TimeZone. Every getServerTimeZone() call after loadServerInfo() failed with ClassCastException. Store the value through ClientConfigProperties.SERVER_TIMEZONE.parseValue(), the same conversion that the client uses when it parses its configuration. Closes ClickHouse#3357
chernser
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Client.getServerTimeZone()threwClassCastException(Stringcannot be cast toTimeZone) on every call afterClient.loadServerInfo().Cause. The parsed client configuration keeps
server_time_zoneas ajava.util.TimeZone, andgetServerTimeZone()casts the value toTimeZone.loadServerInfo()wrote thetimezone()result to the same key as aString.Fix.
loadServerInfo()now stores the value throughClientConfigProperties.SERVER_TIMEZONE.parseValue(...), as the issue suggests. This is the conversion the client already uses when it parses its configuration, so both write paths keep the same type. I preferred this to makinggetServerTimeZone()accept both types, because other readers of this key (QuerySettings,QueryResponse) also cast toTimeZone.Tests. Added
ClientTests#testServerTimeZoneAfterLoadingServerInfo:loadServerInfo(),getServerTimeZone()returns the configured default (UTC);loadServerInfo(), it returns the server'stimezone();setServerTimeZone(...)is returned unchanged.I ran it against a local ClickHouse 26.11 server configured with
Asia/Tokyo(TEST_CLICKHOUSE_CONTAINER=none), JDK 17. Without the fix the test fails with theClassCastExceptionfrom the issue; with the fix it passes and returnsAsia/Tokyo.mvn -pl client-v2 test -Dtest='ClientTests,ParameterizedQueryTest,SettingsTests'also passes locally. I did not run the full integration suite or the Docker-based setup locally.Closes #3357
Checklist
history/latest/3357.md)This change was prepared with AI assistance; I reproduced the bug and ran the tests listed above.
🤖 Generated with Claude Code
Note
Low Risk
Single-line type-alignment fix in server-info loading with regression tests; no auth or data-path changes.
Overview
Fixes
Client#getServerTimeZone()throwingClassCastExceptionafterloadServerInfo()by no longer storing the server'stimezone()result as a rawStringin client configuration.loadServerInfo()now writes the server time zone throughClientConfigProperties.SERVER_TIMEZONE.parseValue(...), matching theTimeZonetype used when configuration is parsed and whatgetServerTimeZone()(and other readers) expect.An integration test verifies default UTC, post-load alignment with the server zone, and unchanged behavior when
setServerTimeZone(...)is configured. A changelog entry is added for issue #3357.Reviewed by Cursor Bugbot for commit 930ab85. Bugbot is set up for automated code reviews on this repo. Configure here.