Skip to content

ClickHouse enforces timestamptz #10289

@mytototo

Description

@mytototo

Describe the bug
Working with Date types from ClickHouse doesn't work, and timestamptz is always enforced even though it's not supported.

To Reproduce
Create a ClickHouse table with a Date column:

CREATE TABLE series (
  date Date,
);

Create Cube.js model, as pasted below.

Then, query the date column, for example:

{
  "dimensions": [
    "series.date"
  ]
}

You will see an error:

Query failed: Error: Unknown data type family: timestamptz. Maybe you meant: ['TIMESTAMP']:

Indeed, the generated SQL is as follow:

SELECT
  timezone('UTC', "series".date :: timestamptz) "series__date"
FROM
  series AS "series"
GROUP BY
  1
ORDER BY
  1 ASC
LIMIT
  10000

Expected behavior
A clear and concise description of what you expected to happen.

Minimally reproducible Cube Schema

cube("Series", {
  data_source: "clickhouse",

  sql: `
    SELECT * FROM series
  `,

  dimensions: {
    date: {
      type: "time",
      sql: "date",
    },
  },
});

Version:
1.6.1

Metadata

Metadata

Assignees

Labels

driver:clickhouseIssues related to the ClickHouse driverquestionThe issue is a question. Please use Stack Overflow for questions.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions