-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
driver:clickhouseIssues related to the ClickHouse driverIssues related to the ClickHouse driver
Description
In anything marked as a type: time, the following code causes Clickhouse DateTime64() columns to be truncated to per-second:
cube/packages/cubejs-schema-compiler/src/adapter/ClickHouseQuery.ts
Lines 42 to 51 in 1cf867a
| public convertTz(field) { | |
| // | |
| // field yields a Date or a DateTime so add in the extra toDateTime64 to support the Date case | |
| // | |
| // https://clickhouse.yandex/docs/en/data_types/datetime/ | |
| // https://clickhouse.yandex/docs/en/query_language/functions/date_time_functions/ | |
| // | |
| // | |
| return `toTimeZone(toDateTime64(${field}, 0), '${this.timezone}')`; | |
| } |
In our case we are wanting to pull logs from the server (with ungrouped: true) and get them ordered according to millisecond/microsecond timestamps which are in the database.
In order to work around this issue I've had to resort to the following hack:
- name: created
sql: created
type: time
primary_key: true
- name: timestamp
description: The unix epoch timestamp of the message
sql: "toFloat64({CUBE}.created)"
type: number
Metadata
Metadata
Assignees
Labels
driver:clickhouseIssues related to the ClickHouse driverIssues related to the ClickHouse driver