Skip to content

Commit 9dd4c29

Browse files
committed
fix templates.statements.generated_time_series_with_cte_range_source
1 parent 60884fb commit 9dd4c29

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ export class DatabricksQuery extends BaseQuery {
192192
' FROM (SELECT explode(sequence(\n' +
193193
' from_utc_timestamp({{ start }}, \'UTC\'), from_utc_timestamp({{ end }}, \'UTC\'), INTERVAL {{ granularity }}\n' +
194194
' )) AS d)';
195+
templates.statements.generated_time_series_with_cte_range_source =
196+
'SELECT d AS date_from,\n' +
197+
'(d + INTERVAL {{ granularity }}) - INTERVAL 1 MILLISECOND AS date_to\n' +
198+
'FROM {{ range_source }}\n' +
199+
'LATERAL VIEW explode(\n' +
200+
' sequence(\n' +
201+
' CAST({{ min_name }} AS TIMESTAMP),\n' +
202+
' CAST({{ max_name }} AS TIMESTAMP),\n' +
203+
' INTERVAL {{ granularity }}\n' +
204+
' )\n' +
205+
') dates AS d';
195206

196207
// TODO: Databricks has `TIMESTAMP_NTZ` with logic similar to Pg's `TIMESTAMP`
197208
// but that requires Runtime 13.3+. Should this be enabled?

0 commit comments

Comments
 (0)