Skip to content

Commit e23cf4a

Browse files
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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 48 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ bytes = "1.5.0"
231231
bytesize = "2"
232232
cbordata = { version = "0.6.0" }
233233
cfg-if = "1.0.0"
234-
chrono = { version = "0.4.40", features = ["serde"] }
235-
chrono-tz = { version = "0.8", features = ["serde"] }
234+
chrono = { version = "0.4.45", features = ["serde"] }
235+
chrono-tz = { version = "0.10.4", features = ["serde"] }
236236
cidr = { version = "0.3.1" }
237237
clap = { version = "4.4.2", features = ["derive"] }
238238
codeq = { version = "0.5.2" }
@@ -323,6 +323,7 @@ aws-smithy-runtime = "1.7.8"
323323
aws-smithy-runtime-api = "1.7.3"
324324
aws-smithy-types = "1.2.13"
325325

326+
iana-time-zone = "0.1.63"
326327
indexmap = "2.0.0"
327328
indicatif = "0.17.5"
328329
itertools = "0.13.0"

src/common/column/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ arrow-buffer = { workspace = true }
2525
arrow-data = { workspace = true }
2626
arrow-schema = { workspace = true }
2727
bytemuck = { workspace = true }
28+
chrono = { workspace = true }
2829
either = { workspace = true }
2930
ethnum = { workspace = true }
3031
foreign_vec = { workspace = true }
3132
hex = { workspace = true }
32-
jiff = { workspace = true }
3333
log = { workspace = true }
3434
match-template = { workspace = true }
3535
num-traits = { workspace = true }

0 commit comments

Comments
 (0)