Skip to content

Add 3 tests for coverage gaps in PR #117667 - #125403

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr117667
Oct 23, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr117667

Conversation

@clickgapai

@clickgapai clickgapai commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Test-only PR. Review: are the gaps real, is the test right.

Adds test coverage for 3 untested code paths, found during automated review of PR #117667.
That PR: (1) The PR makes ConvertImpl forward date_time_overflow_behavior to the numeric -> Date/Date32/DateTime/Time/DateTime64/Time64 transforms (15 sites passed the Ignore default before), routes numeric/Decimal/Date32/DateTime64/Time64 CASTs to DateTime64/Time64 through …

1. NaN -> DateTime64/Time64 via CAST/toDateTime64 has no test
src/Functions/FunctionsConversion.h:815, src/Functions/FunctionsConversion.h:991
Risk: FunctionsConversion.h:813-815 / :989-991: if (isNaN(ticks)) return convertToDecimal<...>(from, scale); after the below / above checks. Risk: dropping that branch, or rewriting the bounds NaN-safe (!(ticks >= min)), turns a NaN into static_cast<Int64>(NaN) (undefined, and …
Unique vs PR tests: The PR's tests feed NaN only to accurateCast* (which reject before the transform) and to the VALUES fallback. Natural home: the 'Non-finite values' block of 04545_bfloat16_to_datetime_saturation.sql or the throw section of 05099.

2. values/VALUES -> Time64 projection untested behind UTC or pre-epoch
src/Interpreters/convertFieldToType.cpp:777, src/Interpreters/convertFieldToType.cpp:762
Risk: The convertFieldToType.cpp:714 branch is the conversion behind the VALUES expression fallback (ValuesBlockInputFormat.cpp:675) and the values table function (convertColumnToTypeOrThrow delegates to convertFieldToType for a non-native target). Lines 762-766 (negative fraction) and …
Unique vs PR tests: 05218 pins the projection for non-negative local times only; this adds the zone-behind-UTC and pre-epoch inputs, where the two PR-added fixups run. Natural home: the 'An in-window DateTime / DateTime64 constant inserted into a Time64 column' block of 05218_datetime64_time64_in_constant_window.sql.

3. throw mode untested for signed/float -> Time and below-range Date32
src/Functions/FunctionsConversion.h:2341, src/Functions/FunctionsConversion.h:665
Risk: CAST(x AS Time) / toTime with an Int8..Int256, Float32, Float64 or BFloat16 source dispatches to ToTimeTransform64Signed<..., date_time_overflow_behavior> (FunctionsConversion.h:2341); before the PR this site passed default_date_time_overflow_behavior, the exact bug the PR …
Unique vs PR tests: 05099 pins throw for 12 of the forwarded branches; signed/float -> Time is the one numeric branch with no out-of-range throw case, and Date32 is pinned only on the upper side. Natural home: append the throw lines to the throw section of 05099_date_time_overflow_behavior_datetime64.sql …

cc @alexey-milovidov (author of #117667), @yariks5s (merged/approved #117667) — could you take a look, and add the can be tested label if this looks good?

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Workflow [PR]
Sync PR [sync-upstream/pr/125403]

Version info

  • Merged into: 26.11.1.621-master (included in 26.11 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author
Pre-PR validation: 6/6 ✅

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
src/Functions/FunctionsConversion.h:813-815 (DateTime64) and :989-991 (Time64), the NaN fallback after the tick-window checks.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 05368_nan_to_datetime64_time64_conversion.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 12, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Oct 18, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f548f57]

Summary: ✅


AI Review

Summary

This PR adds three stateless regression tests for the uncovered branches from #117667: signed/float numeric overflow into Time and lower-bound Date32, NaN conversion into DateTime64 / Time64, and values / VALUES materialization into Time64 for behind-UTC and pre-epoch inputs. I did not find blocker or major issues: the new cases are distinct from the nearby existing coverage, the expected results match the current conversion logic, and the changelog metadata is appropriate for a test-only PR.

Final Verdict

✅ No findings. I would approve this PR.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 18, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 23, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 23, 2026
Merged via the queue into ClickHouse:master with commit 35660be Oct 23, 2026
177 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 23, 2026
@clickhouse-gh clickhouse-gh Bot added comp-datetime Date/DateTime/TimeZone datatypes and date-time semantics. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-datetime Date/DateTime/TimeZone datatypes and date-time semantics. pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants