File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/cubejs-schema-compiler/src/adapter Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -138,9 +138,16 @@ export class PrestodbQuery extends BaseQuery {
138138 templates . functions . DATETRUNC = 'DATE_TRUNC({{ args_concat }})' ;
139139 templates . functions . DATEPART = 'DATE_PART({{ args_concat }})' ;
140140 delete templates . functions . PERCENTILECONT ;
141- templates . statements . select = 'SELECT {{ select_concat | map(attribute=\'aliased\') | join(\', \') }} \n' +
142- 'FROM (\n {{ from }}\n) AS {{ from_alias }} \n' +
141+ templates . statements . select = '{% if ctes %} WITH \n' +
142+ '{{ ctes | join(\',\n\') }}\n' +
143+ '{% endif %}' +
144+ 'SELECT {{ select_concat | map(attribute=\'aliased\') | join(\', \') }} {% if from %}\n' +
145+ 'FROM (\n {{ from }}\n) AS {{ from_alias }} {% elif from_prepared %}\n' +
146+ 'FROM {{ from_prepared }}' +
147+ '{% endif %}' +
148+ '{% if filter %}\nWHERE {{ filter }}{% endif %}' +
143149 '{% if group_by %} GROUP BY {{ group_by }}{% endif %}' +
150+ '{% if having %}\nHAVING {{ having }}{% endif %}' +
144151 '{% if order_by %} ORDER BY {{ order_by | map(attribute=\'expr\') | join(\', \') }}{% endif %}' +
145152 '{% if offset is not none %}\nOFFSET {{ offset }}{% endif %}' +
146153 '{% if limit is not none %}\nLIMIT {{ limit }}{% endif %}' ;
You can’t perform that action at this time.
0 commit comments