Skip to content

Fix LocalDateTime and LocalTime query parameters with zero seconds - #3388

Open
7487 wants to merge 1 commit into
ClickHouse:mainfrom
7487:fix/issue-3387-client-v2-localdatetime-localtime-query-
Open

7487 wants to merge 1 commit into
ClickHouse:mainfrom
7487:fix/issue-3387-client-v2-localdatetime-localtime-query-

Conversation

@7487

@7487 7487 commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

Fix scalar LocalDateTime and LocalTime query parameters by using the existing ClickHouse temporal formatters that always emit seconds. This prevents zero-second DateTime values from being rejected and zero-second Time values from being interpreted as minutes and seconds, while preserving non-zero fractional seconds.

Closes #3387.

Testing

  • Added converter coverage for zero, non-zero, and fractional seconds.
  • Added live ClickHouse round-trip coverage for DateTime, DateTime64, Time, and Time64.
  • Ran the complete client-v2 unit and integration suites against ClickHouse 26.8.
  • Ran the four-module Maven verify/package build, Java compiler checks, targeted Spotless checks, and git diff --check.

Checklist


Note

Low Risk
Targeted change to scalar query-parameter formatting for two Java temporal types, with tests and docs; no auth or core transport changes.

Overview
Scalar LocalDateTime and LocalTime values passed as named query parameters are now serialized through the existing DataTypeUtils nanosecond-aware formatters in convertParameterToString, instead of String.valueOf. That always emits the seconds field and keeps non-zero fractional digits, aligning with ClickHouse DateTime/DateTime64 and Time/Time64 text forms.

This fixes DateTime params with zero seconds that failed server parsing and Time values that were wrongly interpreted as hours/minutes only (e.g. 09:00 vs 09:00:00). Unit and integration round-trip tests plus docs/features.md and changelog note the contract.

Reviewed by Cursor Bugbot for commit e4f4849. Bugbot is set up for automated code reviews on this repo. Configure here.

Fixes ClickHouse#3387.

Signed-off-by: 7487 <1042653432@qq.com>
@7487
7487 requested review from a team and mzitnik as code owners November 19, 2026 03:20
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.

client-v2: LocalDateTime/LocalTime query parameter with zero seconds fails (DateTime) or binds a wrong value (Time)

1 participant