Skip to content

Commit 2fd2251

Browse files
committed
Add param casts templates
1 parent ba6eecd commit 2fd2251

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4133,11 +4133,14 @@ export class BaseQuery {
41334133
like_escape: '{{ like_expr }} ESCAPE {{ escape_char }}',
41344134
within_group: '{{ fun_sql }} WITHIN GROUP (ORDER BY {{ within_group_concat }})',
41354135
concat_strings: '{{ strings | join(\' || \' ) }}',
4136-
rolling_window_expr_timestamp_cast: '{{ value }}'
4136+
rolling_window_expr_timestamp_cast: '{{ value }}',
4137+
timestamp_literal: '{{ value }}'
41374138
},
41384139
tesseract: {
41394140
ilike: '{{ expr }} {% if negated %}NOT {% endif %}ILIKE {{ pattern }}', // May require different overloads in Tesseract than the ilike from expressions used in SQLAPI.
4140-
series_bounds_cast: '{{ expr }}'
4141+
series_bounds_cast: '{{ expr }}',
4142+
bool_param_cast: '{{ expr }}',
4143+
number_param_cast: '{{ expr }}',
41414144
},
41424145
filters: {
41434146
equals: '{{ column }} = {{ value }}{{ is_null_check }}',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ export class BigqueryQuery extends BaseQuery {
335335
templates.filters.like_pattern = 'CONCAT({% if start_wild %}\'%\'{% else %}\'\'{% endif %}, LOWER({{ value }}), {% if end_wild %}\'%\'{% else %}\'\'{% endif %})';
336336
templates.tesseract.ilike = 'LOWER({{ expr }}) {% if negated %}NOT {% endif %} LIKE {{ pattern }}';
337337
templates.tesseract.series_bounds_cast = 'TIMESTAMP({{ expr }})';
338+
templates.tesseract.bool_param_cast = 'CAST({{ expr }} AS BOOL)';
339+
templates.tesseract.number_param_cast = 'CAST({{ expr }} AS FLOAT64)';
338340
templates.types.boolean = 'BOOL';
339341
templates.types.float = 'FLOAT64';
340342
templates.types.double = 'FLOAT64';

0 commit comments

Comments
 (0)