Commit e23cf4a
committed
fix(query): support full timestamp range across time zones (#20416)
Replace Jiff timestamp and zoned projections in SQL datetime paths with Chrono, chrono-tz, and the centralized DatabendTimeZone resolver.
Keep DateLUT as the calendar projection fast path and use Chrono outside its cached years. Apply compatible DST fold/gap resolution consistently and preserve the source offset during calendar arithmetic when possible.
Support the complete Databend Date, Timestamp, and TIMESTAMP_TZ range, including 9999-12-31 23:59:59.999999 and local year 10000 after applying a positive offset. Preserve the existing arithmetic clamp behavior while removing clamps caused only by Jiff's narrower timestamp range.
Make DATE +/- INTERVAL return TIMESTAMP and apply interval components in months, days, then microseconds civil-calendar order. Update parsers, formatters, COPY consumers, Variant conversion, task history, and tests.
Release benchmarks process 100,000 rows and compare this change with upstream/main on the same machine, alternating each binary for 10 rounds (100 samples and at least one second per benchmark). The median of the per-round medians is:
- timestamp_extract_components: 12.905 ms -> 9.283 ms (-28.1%, 1.39x)
- timestamp_add_months: 14.775 ms -> 10.155 ms (-31.3%, 1.45x)
- date_add_days: 66.945 us -> 67.110 us (+0.25%, effectively unchanged)
Timestamp extraction improves because normal values now project directly through DateLUT components instead of constructing a Jiff Zoned value for every extract function. Month arithmetic removes an unconditional Zoned construction and a second components projection; preferred-offset handling is centralized in the resolver. The direct vectorized day-arithmetic path is retained, avoiding a regression for date_add_days.1 parent 92d1a6e commit e23cf4a
77 files changed
Lines changed: 4430 additions & 3459 deletions
File tree
- src
- common
- column
- src/types
- io
- src
- cursor_ext
- tests/it/cursor_ext
- timezone
- src
- query
- expression
- src
- types
- utils
- test-support/src
- tests/it
- formats
- src
- field_decoder
- field_encoder
- output_format
- functions
- benches
- src
- aggregates
- scalars
- timestamp
- src
- tests/it/scalars
- testdata
- service
- src
- pipelines/processors/transforms
- sessions
- query_ctx
- table_functions/get_lineage
- task
- tests/it/servers/http
- settings
- src
- sql
- src/planner
- optimizer/ir/stats
- semantic/type_check
- storages
- common/stage
- src/read/columnar
- orc
- src
- processors
- parquet
- src/parquet_variant_table
- task_support
- src
- system_tables
- table_functions
- tests/sqllogictests/suites/query
- functions
- issues
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
| 234 | + | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments