Skip to content

Commit bb748c0

Browse files
committed
feat(tesseract): Support time series queries in Databricks
1 parent 78ec2a5 commit bb748c0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ export class DatabricksQuery extends BaseQuery {
178178
templates.expressions.interval_single_date_part = 'INTERVAL \'{{ num }}\' {{ date_part }}';
179179
templates.quotes.identifiers = '`';
180180
templates.quotes.escape = '``';
181+
templates.statements.time_series_select = 'SELECT date_from::timestamp AS `date_from`,\n' +
182+
'date_to::timestamp AS `date_to` \n' +
183+
'FROM(\n' +
184+
' VALUES ' +
185+
'{% for time_item in seria %}' +
186+
'(\'{{ time_item | join(\'\\\', \\\'\') }}\')' +
187+
'{% if not loop.last %}, {% endif %}' +
188+
'{% endfor %}' +
189+
') AS dates (date_from, date_to)';
190+
181191
// TODO: Databricks has `TIMESTAMP_NTZ` with logic similar to Pg's `TIMESTAMP`
182192
// but that requires Runtime 13.3+. Should this be enabled?
183193
// templates.types.timestamp = 'TIMESTAMP_NTZ';

0 commit comments

Comments
 (0)