Skip to content

Commit f61afc3

Browse files
authored
feat(databricks-driver): Support for intervals and CURRENT_DATE for sql push down (#9000)
* add single intervals transformation for databricks * add CURRENTDATE support for Databricks SQL Push down
1 parent cd7490e commit f61afc3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export class DatabricksQuery extends BaseQuery {
186186

187187
public sqlTemplates() {
188188
const templates = super.sqlTemplates();
189+
templates.functions.CURRENTDATE = 'CURRENT_DATE';
189190
templates.functions.DATETRUNC = 'DATE_TRUNC({{ args_concat }})';
190191
templates.functions.DATEPART = 'DATE_PART({{ args_concat }})';
191192
templates.functions.BTRIM = 'TRIM({% if args[1] is defined %}{{ args[1] }} FROM {% endif %}{{ args[0] }})';
@@ -197,6 +198,7 @@ export class DatabricksQuery extends BaseQuery {
197198
templates.functions.TRUNC = 'CASE WHEN ({{ args[0] }}) >= 0 THEN FLOOR({{ args_concat }}) ELSE CEIL({{ args_concat }}) END';
198199
templates.expressions.timestamp_literal = 'from_utc_timestamp(\'{{ value }}\', \'UTC\')';
199200
templates.expressions.extract = 'EXTRACT({{ date_part }} FROM {{ expr }})';
201+
templates.expressions.interval_single_date_part = 'INTERVAL \'{{ num }}\' {{ date_part }}';
200202
templates.quotes.identifiers = '`';
201203
templates.quotes.escape = '``';
202204
// TODO: Databricks has `TIMESTAMP_NTZ` with logic similar to Pg's `TIMESTAMP`

0 commit comments

Comments
 (0)