Skip to content

Commit cbdc6e8

Browse files
authored
feat(tesseract): ClickHouse support (#10515)
1 parent 028eadc commit cbdc6e8

File tree

4 files changed

+1734
-850
lines changed

4 files changed

+1734
-850
lines changed

.github/workflows/drivers-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ jobs:
294294
use_tesseract_sql_planner: true
295295
- database: mysql
296296
use_tesseract_sql_planner: true
297+
- database: clickhouse
298+
use_tesseract_sql_planner: true
297299
fail-fast: false
298300

299301
steps:

packages/cubejs-schema-compiler/src/adapter/ClickHouseQuery.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ export class ClickHouseQuery extends BaseQuery {
278278
delete templates.types.interval;
279279
delete templates.types.binary;
280280
templates.expressions.is_not_distinct_from = 'isNotDistinctFrom({{ left }}, {{ right }})';
281+
282+
templates.statements.time_series_select = 'SELECT parseDateTimeBestEffort(dates.f) date_from, parseDateTimeBestEffort(dates.t) date_to \n' +
283+
'FROM (\n' +
284+
'{% for time_item in seria %}' +
285+
' select \'{{ time_item[0] }}\' f, \'{{ time_item[1] }}\' t \n' +
286+
'{% if not loop.last %} UNION ALL\n{% endif %}' +
287+
'{% endfor %}' +
288+
') AS dates';
289+
281290
return templates;
282291
}
283292
}

packages/cubejs-testing-drivers/fixtures/clickhouse.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,68 @@
238238
"Below doesn't work probably due to strict type comparison in ClickHouse, but tests run across all DBs",
239239
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
240240
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
241+
],
242+
"tesseractSkip": [
243+
"---------------------------------------",
244+
"SKIPPED FOR ALL ",
245+
"---------------------------------------",
246+
"querying Products: dimensions -- doesn't work wo ordering",
247+
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
248+
"querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery",
249+
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
250+
"querying ECommerce: partitioned pre-agg",
251+
"querying ECommerce: partitioned pre-agg higher granularity",
252+
"querying BigECommerce: partitioned pre-agg",
253+
"querying BigECommerce: null sum",
254+
"querying BigECommerce: null boolean",
255+
"querying BigECommerce: filtering with possible casts",
256+
257+
"---------------------------------------",
258+
"Unsupported JOIN ON conditions. Unexpected 'big_e_commerce__order_date_month > subtractWeeks(date_to, 2)'",
259+
"---------------------------------------",
260+
"querying BigECommerce: rolling window by 2 day",
261+
"querying BigECommerce: rolling window by 2 week",
262+
"querying BigECommerce: rolling window by 2 month",
263+
"querying BigECommerce: rolling window YTD (month)",
264+
"querying BigECommerce: rolling window YTD (month + week)",
265+
"querying BigECommerce: rolling window YTD (month + week + no gran)",
266+
"querying BigECommerce: rolling window YTD (month + week + day)",
267+
"querying BigECommerce: rolling window YTD (month + week + day + no gran)",
268+
"querying BigECommerce: time series in rolling window",
269+
"---------------------------------------",
270+
"Custom Granularities ",
271+
"---------------------------------------",
272+
"querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded",
273+
"querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing",
274+
"querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading",
275+
"querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading without date range",
276+
277+
"---------------------------------------",
278+
"There is no time series generation in ClickHouse.",
279+
"---------------------------------------",
280+
"querying BigECommerce: rolling window by 2 day without date range",
281+
"querying BigECommerce: rolling window by 2 month without date range",
282+
"querying BigECommerce: rolling window YTD without date range",
283+
"---------------------------------------",
284+
"SKIPPED SQL API (Need work)",
285+
"---------------------------------------",
286+
"SQL API: Complex Rollup",
287+
"SQL API: Extended nested Rollup over asterisk",
288+
"SQL API: Nested Rollup over asterisk",
289+
"SQL API: Rollup over exprs",
290+
"SQL API: Rollup with aliases",
291+
"SQL API: Simple Rollup",
292+
"SQL API: SQL push down push to cube quoted alias",
293+
294+
"SKIPPED SQL API (due to inconsistency)",
295+
"---------------------------------------",
296+
"Below doesn't work probably due to strict type comparison in ClickHouse, but tests run across all DBs",
297+
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
298+
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)",
299+
300+
"SQL API: Timeshift measure from cube",
301+
"querying SwitchSourceTest: simple cross join",
302+
"querying SwitchSourceTest: full cross join"
303+
241304
]
242305
}

0 commit comments

Comments
 (0)