You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add 3 tests for coverage gaps in PR #117667 - #125403
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/Time64CASTs 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 …
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.
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.
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
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.
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
ConvertImplforwarddate_time_overflow_behaviorto the numeric ->Date/Date32/DateTime/Time/DateTime64/Time64transforms (15 sites passed theIgnoredefault before), routes numeric/Decimal/Date32/DateTime64/Time64CASTs toDateTime64/Time64through …1. NaN ->
DateTime64/Time64viaCAST/toDateTime64has no testsrc/Functions/FunctionsConversion.h:815,src/Functions/FunctionsConversion.h:991Risk:
FunctionsConversion.h:813-815/:989-991:if (isNaN(ticks)) return convertToDecimal<...>(from, scale);after thebelow/abovechecks. Risk: dropping that branch, or rewriting the bounds NaN-safe (!(ticks >= min)), turns a NaN intostatic_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 theVALUESfallback. Natural home: the 'Non-finite values' block of 04545_bfloat16_to_datetime_saturation.sql or thethrowsection of 05099.2.
values/VALUES->Time64projection untested behind UTC or pre-epochsrc/Interpreters/convertFieldToType.cpp:777,src/Interpreters/convertFieldToType.cpp:762Risk: The
convertFieldToType.cpp:714branch is the conversion behind theVALUESexpression fallback (ValuesBlockInputFormat.cpp:675) and thevaluestable function (convertColumnToTypeOrThrowdelegates toconvertFieldToTypefor 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.
throwmode untested for signed/float ->Timeand below-rangeDate32src/Functions/FunctionsConversion.h:2341,src/Functions/FunctionsConversion.h:665Risk:
CAST(x AS Time)/toTimewith anInt8..Int256,Float32,Float64orBFloat16source dispatches toToTimeTransform64Signed<..., date_time_overflow_behavior>(FunctionsConversion.h:2341); before the PR this site passeddefault_date_time_overflow_behavior, the exact bug the PR …Unique vs PR tests: 05099 pins
throwfor 12 of the forwarded branches; signed/float ->Timeis the one numeric branch with no out-of-rangethrowcase, andDate32is pinned only on the upper side. Natural home: append the throw lines to thethrowsection 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 testedlabel if this looks good?Changelog category (leave one):
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
Workflow [PR]
Sync PR [sync-upstream/pr/125403]
Version info
26.11.1.621-master(included in26.11and later)