Skip to content

fix: DateTimeParts cast failures - #9402

Merged
joseph-isaacs merged 3 commits into
developfrom
aduffy/fix-dtp-cast
Aug 14, 2026
Merged

fix: DateTimeParts cast failures#9402
joseph-isaacs merged 3 commits into
developfrom
aduffy/fix-dtp-cast

Conversation

@a10y

@a10y a10y commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

We had a latent bug here where if you had a DTP that narrowed from i64 -> something smaller, and then you had a larger i64 come along as a constant to compare against, that compare would fail and the failure would propagate to the caller.

What changes are included in this PR?

Instead of letting the cast fail lazily at execution time, we cast the constant upfront, and if it fails we handle it.

If the value is large positive i64, then we can assume > all of lhs

If the value is large negative i64, then we can assume < all of lhs

What APIs are changed? Are there any user-facing changes?

None

We had a latent bug here where if you had a DTP that narrowed
from i64 -> something smaller, and then you had a larger i64 come
along as a constant to compare against, that compare would fail and the
failure would propagate to the caller.

Signed-off-by: Andrew Duffy <andrew@a10y.dev>
@a10y
a10y requested review from AdamGS and robert3005 August 13, 2026 17:17
@a10y a10y added the changelog/fix A bug fix label Aug 13, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 13, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 1.51%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 1992 untouched benchmarks
⏩ 89 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime words_gather_scalar[65536] 8.3 µs 9.4 µs -11.82%
WallTime words_gather_dispatch[1024] 33 ns 30 ns +10%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing aduffy/fix-dtp-cast (5e8d836) with develop (1a493b6)

Open in CodSpeed

Footnotes

  1. 89 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@joseph-isaacs joseph-isaacs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about boundary conditions with => and others?

also it is always signed or do we allow signed and unsigned values?

@a10y

a10y commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

are you sure about boundary conditions with => and others?

Hmm you mean because of nulls?

also it is always signed or do we allow signed and unsigned values?

This particular codepath we always receive i64, and those can be negative if e.g. timestamp is before epoch

a10y added 2 commits August 13, 2026 14:29
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
@a10y

a10y commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Ok I pushed a fix for nulls handling

@joseph-isaacs
joseph-isaacs merged commit 86e9710 into develop Aug 14, 2026
81 of 82 checks passed
@joseph-isaacs
joseph-isaacs deleted the aduffy/fix-dtp-cast branch August 14, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants