Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jdbc] Incorrect DateTime results when writing numeric data with use_time_zone property #2066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

haishui126
Copy link
Contributor

@haishui126 haishui126 commented Jan 3, 2025

Summary

Refer to #2065.
When I use ClickHouse JDBC to insert data, the server's time zone is UTC, while my client's time zone is UTC+8. The JDBC first converts my numeric data to a LocalDateTime in the UTC time zone. This time object is then treated as a LocalDateTime in the UTC+8 time zone when written into ClickHouse, resulting in the written result being 8 hours behind.

Checklist

Delete items not relevant to your PR:

@mshustov mshustov requested a review from Paultagoras January 16, 2025 07:36
@chernser
Copy link
Contributor

This PR need to be ported/verified with jdbc-v2

@haishui126
Copy link
Contributor Author

@chernser This PR addresses the time zone issue when converting Long type to LocalDateTime type in the clickhouse-data module. The jdbc-v2 does not use the clickhouse-data module, so this change will not affect v2. However, I tested v2 in 0.8.0, and found that writing Long type to DateTime64 is fine, but when writing LocalDateTime type to DateTime64, it seems that the use_time_zone setting does not take effect.

@chernser
Copy link
Contributor

chernser commented Feb 8, 2025

@haishui126 thank you for the info!
I've created the issue #2134

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.

2 participants