Skip to content

Fix setting ignored for numeric-to-DateTime64/Time64 casts - #100535

Closed
ai-mountain wants to merge 58 commits into
ClickHouse:masterfrom
ai-mountain:fix-datetime-overflow-behavior
Closed

ai-mountain wants to merge 58 commits into
ClickHouse:masterfrom
ai-mountain:fix-datetime-overflow-behavior

Conversation

@ai-mountain

@ai-mountain ai-mountain commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Fix date_time_overflow_behavior setting being ignored when casting numeric types (Int64, UInt64, Float64) to DateTime64 / Time64. The setting was silently clamping values instead of throwing VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE when set to throw.

Two root causes:

  1. In ConvertImpl::execute (FunctionsConversion.h), 15 conversion branches passed the hardcoded default_date_time_overflow_behavior (Ignore) instead of the template parameter date_time_overflow_behavior to the transform structs. This broke the toDateTime64 / toTime64 runtime path.

  2. In FunctionCast::createDecimalWrapper (FunctionsConversion.cpp), ConvertImpl was called without specifying the overflow behavior template parameter, always defaulting to Ignore. This broke the CAST(... AS DateTime64) path, including constant-folded expressions.

Fixes #100471

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix date_time_overflow_behavior setting being ignored for numeric-to-DateTime64/Time64 conversions via CAST, toDateTime64, and toTime64.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

No documentation changes needed — this is a bug fix for existing documented behavior.


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

@yariks5s yariks5s self-assigned this Mar 24, 2026
@yariks5s yariks5s added the can be tested Allows running workflows for external contributors label Mar 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e7acc30]

Summary: ❌

job_name test_name status info comment
Stress test (amd_tsan) FAIL
S3_ERROR No such key thrown (see clickhouse-server.log or no_such_key_errors.txt) FAIL cidb

AI Review

Summary

This PR threads date_time_overflow_behavior and accurate-cast semantics through the main numeric-to-DateTime64 / Time64 paths, and it adds solid regression coverage for Int*, UInt*, Float32, Float64, Date32, DateTime64, and decimal sources. I found one remaining correctness gap: BFloat16 is still routed through the generic decimal conversion path, so plain CAST / toDateTime64 / toTime64 does not honor the new overflow behavior for that numeric source at all.

Findings

⚠️ Majors

  • [src/Functions/FunctionsConversion.h:2429] BFloat16 is omitted from the float-specific DateTime64 / Time64 dispatch, so it falls back to generic number-to-decimal conversion and throws NOT_IMPLEMENTED from src/DataTypes/DataTypesDecimal.cpp instead of saturating or throwing VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE according to date_time_overflow_behavior.
    Suggested fix: route BFloat16 through ToDateTime64TransformFloat / ToTime64TransformFloat the same way Float32 / Float64 are handled.
Tests
  • ⚠️ Add a focused regression for BFloat16 -> DateTime64 and BFloat16 -> Time64 in saturate and throw modes; the new suite covers the other float-like sources but leaves this remaining numeric path untested.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: fix the BFloat16 dispatch for plain DateTime64 / Time64 conversions and add a regression that exercises the overflow behavior on that path.

LLVM Coverage Report

Measured on commit e7acc30.

Metric Baseline Current Δ
Lines 88.30% 88.30% +0.00%
Functions 92.20% 92.10% -0.10%
Branches 79.70% 79.70% +0.00%

Changed lines: Changed C/C++ lines covered: 239/255 (93.73%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 24, 2026
@ai-mountain
ai-mountain force-pushed the fix-datetime-overflow-behavior branch from 0c9fc33 to 1d4b032 Compare March 25, 2026 02:23
Comment thread src/Functions/FunctionsConversion.h Resolved
@ai-mountain
ai-mountain force-pushed the fix-datetime-overflow-behavior branch from 1d4b032 to afa6e33 Compare March 25, 2026 04:06
@ai-mountain

Copy link
Copy Markdown
Contributor Author

@yariks5s
I updated code. Please review again. Thanks.

@ai-mountain

Copy link
Copy Markdown
Contributor Author

@rschu1ze @alexey-milovidov @yariks5s
Can you review my PR please? Thanks.

@yariks5s

Copy link
Copy Markdown
Member

@RenzoMXD I will check your PR soon, there are a lot of PRs to check, so it can sometimes take some time to review pull requests. Anyway, I remember about your pr and will check it.🙂

@rschu1ze

Copy link
Copy Markdown
Member

@RenzoMXD Thanks for the contribution(s). There is generally no need to ping random people, all PRs get eventually reviewed (it may just take a while).

@ai-mountain

ai-mountain commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor Author

@yariks5s @rschu1ze Thanks. Sorry for many pings.

@ai-mountain

Copy link
Copy Markdown
Contributor Author

Hi, @yariks5s. Sorry for interrupting you.
Is there any feedback for me?
I merged main branch and I think this failure is not from my change.
Please review. Thanks.

@rschu1ze

rschu1ze commented Apr 2, 2026

Copy link
Copy Markdown
Member

@RenzoMXD In general, it is really not needed to ask for new reviews once a day. This creates a false sense of urgency and priority on our end.

@ai-mountain

Copy link
Copy Markdown
Contributor Author

Hi, @yariks5s @alexey-milovidov @rschu1ze
Please review my PR and let me know if anything else is needed to update.
Thanks.

@alexey-milovidov

Copy link
Copy Markdown
Member

The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix.

@ai-mountain

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov Please give me any advice for this failure.
I don't think it's from my change. Thanks.

Comment thread src/Functions/FunctionsConversion.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

The failures of "Flaky check" in "functions_bad_arguments" will be fixed by #101994.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Pass 2026-09-06:

  • Merged origin/master (single merge base this time, zero conflicts; submodule gitlinks match master).
  • Fixed the only real CI red, the Fast test failure in 01734_datetime64_from_float (a32b304): the test pinned the old whole-second clamp for the two float sources at scale 9. Since 2a3a8e7 fractional sources saturate to the exact boundary tick (1677-09-21 00:12:43.145224192 / 2262-04-11 23:47:16.854775807) while integer sources still saturate to the last whole second, so only the two float lines of the reference changed; the integer lines and 04848_date32_to_datetime64_scale_overflow (Date32 sources) are unaffected. The Finish Workflow red was derived from it (Bugfix validation was dropped after the Fast test failure).
  • Verified locally: clickhouse builds warning-free; 01734 plus the 13 stateless tests of this PR and the master tests it touches (03011, 04092, 04145, 04402, 04403, 04545×2, 04653, 04846, 04847, 05044, 05076, 02900) all pass under clickhouse local.

Comment thread src/Functions/FunctionsConversion.cpp Resolved
@rschu1ze

rschu1ze commented Sep 8, 2026

Copy link
Copy Markdown
Member

@yariks5s Like to check this PR again? Thanks.

alexey-milovidov and others added 4 commits September 15, 2026 20:20
…ow-behavior

Master independently landed exact-tick saturation for `DateTime64` / `Time64`
(the `maxTicksForDateTime64` / `minTicksForDateTime64` / `maxTicksForTime64`
helpers and integer sources saturating to the last tick, not the whole second).

Resolution: master's helpers in `DateTimeTransforms.h`; this branch's bodies of
`ToDateTime64TransformFloat` / `ToTime64TransformFloat` (they keep the exact-tick
`throw` check via `floatSecondsToTicks` and the up-front non-finite rejection);
master's wide-integer and `UInt32 -> Time64` dispatch entries with this branch's
`date_time_overflow_behavior` template argument applied to them as well;
master's `01734_datetime64_from_float.reference` (integer sources saturate to
the exact tick now too).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…o `DateTime64` follow the accurate-cast contract

The `Date32 -> DateTime64` branch of `createDecimalWrapper` dispatched purely by
`date_time_overflow_behavior`, so `accurateCastOrNull(toDate32('9999-12-31'), 'DateTime64(9)')`
returned the saturated `2262-04-11 23:47:16.854775807` under `ignore` / `saturate` instead of
NULL, and `accurateCast` only threw when the session was already on `throw`.

`accurateCast` now dispatches the transform with `Throw`; `accurateCastOrNull` uses a new
file-local `convertDate32ToDateTime64OrNull` that yields NULL for a day whose midnight does
not fit the scale-dependent whole-second window (the same check as `ToDateTime64Transform`).
The plain `CAST` keeps following the setting.

Test `05218_accurate_cast_date32_to_datetime64` covers a materialized `Date32` column at
scale 9 under all three overflow modes, constants, scales 3 and 8, and the plain `CAST`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ster routes into the transforms

Master now dispatches `(U)Int128` / `(U)Int256` sources into `ToDateTimeTransform64*`,
`ToDateTime64Transform*` and `ToTime64Transform*`; with this PR passing the real
`date_time_overflow_behavior` the `Throw` instantiations are compiled for them too.
`wide::integer` has no `fmt` formatter, so format the value with `toString`.

`ToDateTime64TransformUnsigned` also compared `static_cast<UInt64>(from)` in its `Throw`
branch, which truncates a wide value above `UInt64::max` into one that passes the check
(and the following implicit narrowing was ambiguous for wide integers). Compare with
`accurate::greaterOp` in the source domain, like the non-throwing branch already does.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…er the merge

Master made integer sources saturate `DateTime64` / `Time64` to the last representable tick
(`.999...`) rather than the last whole second, so the branch's whole-second assertions in
`04402_datetime64_extended_range_review_fixes` and `04403_totime64_saturate_clamp` are replaced
with master's forms (this PR keeps only its float exact-boundary and `throw` assertions in
04402), and the upper saturation lines of `04145_date_time_overflow_behavior_numeric_to_datetime64`
are re-recorded from `23:59:59.000` to `23:59:59.999`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Pass 2026-09-15:

  • Merged origin/master (908f730). Master independently landed exact-tick saturation for DateTime64 / Time64 (the maxTicksForDateTime64 / minTicksForDateTime64 / maxTicksForTime64 helpers, and integer sources now saturating to the last tick too), plus wide-integer ((U)Int128 / (U)Int256) dispatch into the same transforms. Resolution: master's helpers; this branch's ToDateTime64TransformFloat / ToTime64TransformFloat bodies (they keep the exact-tick throw check and the up-front non-finite rejection); master's wide-integer and UInt32 -> Time64 dispatch entries with this PR's date_time_overflow_behavior argument applied to them as well. With integers now saturating to .999... on master, this PR's earlier "integers stop at the whole second" choice is moot: 04402 / 04403 take master's integer assertions (04403 no longer differs from master) and 04145 is re-recorded (2027f62).
  • Addressed the AI review blocker (Date32 -> DateTime64 under accurateCast / accurateCastOrNull), see the thread reply; new test 05218_accurate_cast_date32_to_datetime64 (0457f19).
  • c249e33: the Throw branches are now instantiated for the wide integer sources master routes into the transforms. wide::integer has no fmt formatter, so the values are formatted with toString. While there, ToDateTime64TransformUnsigned's Throw branch compared static_cast<UInt64>(from), which truncates a value above UInt64::max (e.g. toUInt128(18446744073709551616)) into one that passes the check; it now compares with accurate::greaterOp in the source domain like the non-throwing branch.
  • Verified locally: clickhouse builds warning-free; 16 stateless tests (this PR's 12, 01734, 04092, 04626, 04652, 04837) pass with clickhouse-test against a scratch server.

@clickhouse-gh

clickhouse-gh Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

⚠️ AI verdict: not_sure — no significant changes across 32 queries analysed

This PR changes CAST conversions to DateTime64, Time64, Date and Time: accurateCast/accurateCastOrNull checks, handling of the overflow-behavior setting, and range checks for float inputs. None of the benchmarked ClickBench or TPC-H queries runs these paths in a meaningful way. ClickBench Q33 (-10.1%) and Q34 (-6.8%) only show as not_sure because master's own baseline moved to a new level on 2026-10-08, which leaves their baselines unstable. Neither delta should be credited to this change, and nothing here needs action.

clickbench

⚠️ 2 inconclusive

Flagged queries (2 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 33 not_sure 1143 1027 -10.1% <0.0001 aggregation: This query is a heavy GROUP BY with no conversion to DateTime64, Time64, Date or Time, so the CAST changes in this PR are not on its path. The -10.1% shift comes from master moving to a new performance level around 2026-10-08.
⚠️ 34 not_sure 1141 1063 -6.8% <0.0001 aggregation: This query is a heavy GROUP BY that does not run the changed CAST paths. The -6.8% shift matches the change in master's performance level around 2026-10-08, not this diff.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: c6b5f0f7-08da-4a6e-8fa0-b868a9ad9c39
  • MIRAI run: f2e34bd1-7b57-44a4-83f7-23980d8a9a81
  • PR check IDs:
    • clickbench_399372_1791479852
    • clickbench_399378_1791479852
    • clickbench_399389_1791479852
    • tpch_adapted_1_official_399400_1791479853
    • tpch_adapted_1_official_399413_1791479853
    • tpch_adapted_1_official_399442_1791479853

alexey-milovidov and others added 2 commits September 23, 2026 01:19
…rces

`05042_datetime64_saturate_to_max_tick` and `05156_big_integer_to_datetime_overflow`
landed on master asserting that numeric -> `DateTime`/`DateTime64`/`Time64`
conversions saturate even under `date_time_overflow_behavior = 'throw'`, which both
tests described as a pre-existing gap. That gap is exactly what this PR fixes, so
the conversions now throw `VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100535&sha=2027f62411b9b7f6604bbde14fecfa1b504ff68e&name_0=PR&name_1=Fast%20test
PR: ClickHouse#100535

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged current master (clean, no conflicts) and fixed the Fast test red. Two tests that landed on master since the last pass, 05042_datetime64_saturate_to_max_tick and 05156_big_integer_to_datetime_overflow, asserted that numeric -> DateTime/DateTime64/Time64 conversions saturate even under date_time_overflow_behavior = 'throw'. Both tests called this "a separate, pre-existing gap", and that gap is what this PR fixes. Those assertions now expect VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE (c9b7ddf). I rebuilt locally without warnings and ran a stateless sweep of 387 tests touching date_time_overflow_behavior/accurateCast/toDateTime64/toTime64. Every failure was environment-only (no test clusters, ZooKeeper or query_log on the bare local server). The Date32 accurate-cast review thread was fixed in 0457f19 and is now resolved.

Comment thread src/Functions/FunctionsConversion.cpp Resolved
Comment thread src/Functions/FunctionsConversion.cpp Resolved
Comment thread src/Functions/FunctionsConversion.cpp Resolved
alexey-milovidov and others added 3 commits October 1, 2026 09:19
…ur `date_time_overflow_behavior` for `Enum` sources

`floatSecondsToTicks` truncated the scaled value into an `Int128`. That conversion goes through `long double`,
which is emulated in software on AArch64, so `toDateTime64(<Float64>, 3)` became ~50% slower in the
`add_days_fixed_offset` performance test (queries 4-6, arm_release). Range-check the scaled `Float64` against
[-2^63, 2^63) instead and truncate straight into `Int64`, which is well defined there.

`FunctionConvert` dispatched `Enum8`/`Enum16` -> `DateTime`/`Date` with the default overflow mode, so
`toDateTime(<Enum8 'neg' = -1>)` ignored `date_time_overflow_behavior = 'throw'` while the `Int8` source
honoured it. Route `Enum` sources through the overflow-aware dispatch too, and update the master test
`05238_enum_to_datetime_overflow` that pinned the gap.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100535&sha=c9b7ddfb2c9160c9e56e25e0ea69088ec27fd3b6&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%204%2F6%29
PR: ClickHouse#100535

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…me64`, route `DateTime64 -> Time64` through `ConvertImpl`

- `accurateCast`/`accurateCastOrNull` from a floating-point number now reject a value whose fractional part is
  finer than the target scale (`accurateCast(1.1::Float64, 'DateTime64(0)')`, like `1.1` for `DateTime`).
  Both casts now use the file-local `convertNumberToDateTime64OrTime64Accurate`.
- Decimal sources (including `DateTime64 -> DateTime64`) get the same exactness gate as the generic accurate
  decimal-to-decimal conversion before `tryConvertDecimals`, which silently drops extra fractional digits.
- `DateTime64 -> Time64` is the local time of day, not a decimal rescale: the accurate casts go through its
  dedicated `ConvertImpl` branch again instead of range-checking the raw epoch ticks.

Test `05315_accurate_cast_datetime64_time64_exactness`; `05076` narrowed `.999` to scale 1, now uses `.900`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged master (5634 commits, no conflicts) and pushed c4d59727bef6:

  • Perf (arm_release add_days_fixed_offset doc: fix typo #4-fix docs #6, +50%): this was a real regression from this PR, not noise. floatSecondsToTicks truncated into Int128, and that conversion goes through long double, which AArch64 emulates in software. It now range-checks the scaled Float64 against [-2^63, 2^63) and truncates straight into Int64. Saturation results are unchanged.
  • 3 clickhouse-gh threads (adopted and resolved): accurate casts to DateTime64/Time64 now also reject precision loss for float and decimal sources, and DateTime64 -> Time64 goes through its dedicated ConvertImpl branch again. New test 05315_accurate_cast_datetime64_time64_exactness.
  • Enum8/Enum16 -> DateTime/Date still ignored throw, while Int8 honoured it. The new master test 05238_enum_to_datetime_overflow pinned that gap. Fixed in the FunctionConvert dispatch and updated the test.

Local run: all .sql stateless tests that touch accurateCast* or date_time_overflow_behavior pass, except ones that need clusters, ZooKeeper or query_log, which this local setup does not have.

Comment thread src/Functions/FunctionsConversion.cpp Resolved
alexey-milovidov and others added 2 commits October 8, 2026 13:28
…urate `DateTime64 -> Time64`

`accurateCastOrNull` still range-checked the raw epoch ticks of the source
against `Time64` with `tryConvertDecimals`, so any source later than
`MAX_TIME_TIMESTAMP` seconds after the epoch returned `NULL` instead of its
time of day. The result is the local seconds-of-day, which is always within
the `Time64` range, so the range gate is dropped.

The only way the accurate casts can lose information is by dropping
sub-second digits when the target scale is narrower than the source scale.
Both `accurateCast` and `accurateCastOrNull` now reject such inputs, the same
as the `Time64 -> Time64` and `Time64 -> DateTime64` accurate paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100535&sha=c4d59727bef6c3d475f205866c73de5913bd735d&name_0=PR&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29 (TLP DISTINCT oracle mismatch for SELECT DISTINCT NULL FROM tab WHERE a > [NULL] WINDOW ..., unrelated to the DateTime64 / Time64 conversions changed here) and provide a fix in a separate PR. If the fix is already in progress, link it here.

Comment thread src/Functions/FunctionsConversion.h Resolved
@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

I reproduced it: this is a real wrong result in partition pruning, not an oracle false positive. The WINDOW clauses do not matter; the fuzzed table is PARTITION BY a over a Array(String).

CREATE TABLE t (a Array(String)) ENGINE = MergeTree PARTITION BY a ORDER BY tuple();
INSERT INTO t VALUES (['x']), (['y']), (['x', 'z']);
SELECT count() FROM t WHERE NOT (a > [NULL]);                                    -- 0
SELECT count() FROM t WHERE NOT (a > [NULL]) SETTINGS use_partition_pruning = 0; -- 3

Same result on 26.3.33.24 and 26.8.2.3. a > [NULL] is 0 for every row (['x'] < [NULL] is 1), but the partition condition is _CAST(a) in (-Inf, [NULL]] with bounds ordered by Field::operator<, which puts the nested Null first, so all 3 partitions are pruned. Map behaves the same: m <= map('k', NULL) on PARTITION BY m returns 0 instead of 2.

No fix is in progress: #118944 looks for a nested NULL only inside a Tuple constant, and my #116655 only declines a key whose own elements are Nullable (here the key is Array(String)). I'll send a separate PR and link it here.

@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Fixing PR: #124700

@clickhouse-gh

clickhouse-gh Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Dear @yariks5s, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Closing as superseded: the issue this PR targets, #100471, was fixed on master by #117667 (merged 2026-10-10). That PR covers the same two root causes: the default_date_time_overflow_behavior arguments in ConvertImpl and the createDecimalWrapper dispatch. It also covers the BFloat16, wide-integer, Enum, Decimal and Date32 sources, and saturation to the extreme tick.

Evidence (base origin/master = d6c2532ef9082ee647fea25e1c153b9e9b35b6b7):

  • git merge-base --is-ancestor cdab39df2f8 origin/master succeeds, and no later commit touching FunctionsConversion.{h,cpp} reverts it.
  • On the master build 0a305256204: toDateTime64(99999999999999::UInt64, 3) and CAST(1e30::Float64 AS DateTime64(3)) with throw raise VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE. BFloat16 sources saturate or throw according to the setting.
  • This PR's new tests 04145, 04545_..._uint64_to_date_datetime and 04847 pass unchanged on master.

The remaining differences are deliberate choices on master, not missing fixes:

  • accurateCast out of range raises CANNOT_CONVERT_TYPE (the usual accurateCast code) instead of VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE.
  • toDateTime64(nan, 3) raises DECIMAL_OVERFLOW.
  • accurateCast truncates a fraction that the target scale cannot express, the same way it does for Decimal, instead of rejecting it. Honour date_time_overflow_behavior for numeric conversions #117667 documents this explicitly.

Merging master into this branch would conflict with both conversion files and 10 tests, and keeping this PR's version would override those decisions. If you want any of these semantics (for example, strict exactness in accurateCast), please open a small follow-up PR on top of current master. Thank you for the work and the thorough tests!

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-regular-function Regular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi... pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date_time_overflow_behavior='throw' silently ignored for Int/UInt/Float -> DateTime64 and Time64 casts

8 participants