This repository was archived by the owner on Jun 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Add fully fledged time zones support #200
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Despite ClickHouse itself featuring great time zone(s) support, these two driver features were never enabled:
:set-timezone
:convert-timezone
There was a draft attempt from me recently, with this snippet commented out and a few other parts missing:
metabase-clickhouse-driver/src/metabase/driver/clickhouse_qp.clj
Lines 320 to 327 in b199284
;; FIXME: there are still many failing tests that prevent us from turning this feature on | |
;; (defmethod sql.qp/->honeysql [:clickhouse :convert-timezone] | |
;; [driver [_ arg target-timezone source-timezone]] | |
;; (let [expr (sql.qp/->honeysql driver (cond-> arg (string? arg) u.date/parse)) | |
;; with-tz-info? (h2x/is-of-type? expr #"(?:nullable\(|lowcardinality\()?(datetime64\(\d, {0,1}'.*|datetime\(.*)") | |
;; _ (sql.u/validate-convert-timezone-args with-tz-info? target-timezone source-timezone) | |
;; inner (if (not with-tz-info?) [:'toTimeZone expr source-timezone] expr)] | |
;; [:'toTimeZone inner target-timezone])) |
However, a significant amount of Metabase timezone-related tests fail, most of the time because of hardcoded branches for specific drivers.
Examples of such tests:
- https://github.com/metabase/metabase/blob/master/test/metabase/query_processor_test/date_time_zone_functions_test.clj#L273-L304
- https://github.com/metabase/metabase/blob/master/test/metabase/query_processor_test/date_time_zone_functions_test.clj#L190-L198
- https://github.com/metabase/metabase/blob/master/test/metabase/query_processor_test/date_time_zone_functions_test.clj#L705-L722
Related Metabase issue to remove the hardcoded parts: metabase/metabase#26807
enqueue
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request