Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Add fully fledged time zones support #200

@slvrtrn

Description

@slvrtrn

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:

;; 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:

Related Metabase issue to remove the hardcoded parts: metabase/metabase#26807

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions