Improve readability
This commit is contained in:
parent
468f641af8
commit
967dca9578
@ -159,11 +159,15 @@ var dateOverrideBasicsQueryTpl = dot.template([
|
|||||||
' max({{=it._end}}) AS max_val,',
|
' max({{=it._end}}) AS max_val,',
|
||||||
' min({{=it._start}}) AS min_val,',
|
' min({{=it._start}}) AS min_val,',
|
||||||
' avg(date_part(\'epoch\', {{=it._column}})) AS avg_val,',
|
' avg(date_part(\'epoch\', {{=it._column}})) AS avg_val,',
|
||||||
' min(date_trunc(',
|
' min(',
|
||||||
' \'{{=it._aggregation}}\',',
|
' date_trunc(',
|
||||||
' TO_TIMESTAMP({{=it._start}})::timestamp AT TIME ZONE \'{{=it._timezone}}\'',
|
' \'{{=it._aggregation}}\',',
|
||||||
' )) AS start_date,',
|
' TO_TIMESTAMP({{=it._start}})::timestamp AT TIME ZONE \'{{=it._timezone}}\'',
|
||||||
' max(TO_TIMESTAMP({{=it._end}})::timestamp AT TIME ZONE \'{{=it._timezone}}\') AS end_date,',
|
' )',
|
||||||
|
' ) AS start_date,',
|
||||||
|
' max(',
|
||||||
|
' TO_TIMESTAMP({{=it._end}})::timestamp AT TIME ZONE \'{{=it._timezone}}\'',
|
||||||
|
' ) AS end_date,',
|
||||||
' count(1) AS total_rows',
|
' count(1) AS total_rows',
|
||||||
' FROM ({{=it._query}}) _cdb_basics',
|
' FROM ({{=it._query}}) _cdb_basics',
|
||||||
')'
|
')'
|
||||||
@ -177,15 +181,11 @@ var dateBinsQueryTpl = dot.template([
|
|||||||
' FROM (',
|
' FROM (',
|
||||||
' SELECT',
|
' SELECT',
|
||||||
' ARRAY(',
|
' ARRAY(',
|
||||||
' {{?it._aggregation==="quarter"}}',
|
|
||||||
' SELECT GENERATE_SERIES(start_date::timestamptz, end_date::timestamptz, \'3 month\'::interval)',
|
|
||||||
' {{??}}',
|
|
||||||
' SELECT GENERATE_SERIES(',
|
' SELECT GENERATE_SERIES(',
|
||||||
' start_date::timestamptz,',
|
' start_date::timestamptz,',
|
||||||
' end_date::timestamptz,',
|
' end_date::timestamptz,',
|
||||||
' \'1 {{=it._aggregation}}\'::interval',
|
' {{?it._aggregation==="quarter"}}\'3 month\'{{??}}\'1 {{=it._aggregation}}\'{{?}}::interval',
|
||||||
' )',
|
' )',
|
||||||
' {{?}}',
|
|
||||||
' ) AS bins_array',
|
' ) AS bins_array',
|
||||||
' FROM basics',
|
' FROM basics',
|
||||||
' ) _cdb_bins_array',
|
' ) _cdb_bins_array',
|
||||||
@ -207,10 +207,14 @@ var dateHistogramQueryTpl = dot.template([
|
|||||||
' bins_number',
|
' bins_number',
|
||||||
' )) - 1',
|
' )) - 1',
|
||||||
' END AS bin,',
|
' END AS bin,',
|
||||||
' min(date_part(',
|
' min(',
|
||||||
' \'epoch\', ',
|
' date_part(',
|
||||||
' date_trunc(\'{{=it._aggregation}}\', {{=it._column}}::timestamptz',
|
' \'epoch\', ',
|
||||||
' ) AT TIME ZONE \'{{=it._timezone}}\'))::numeric AS timestamp,',
|
' date_trunc(',
|
||||||
|
' \'{{=it._aggregation}}\', {{=it._column}}::timestamptz',
|
||||||
|
' ) AT TIME ZONE \'{{=it._timezone}}\'',
|
||||||
|
' )',
|
||||||
|
' )::numeric AS timestamp,',
|
||||||
' min(date_part(\'epoch\', {{=it._column}}))::numeric AS min,',
|
' min(date_part(\'epoch\', {{=it._column}}))::numeric AS min,',
|
||||||
' max(date_part(\'epoch\', {{=it._column}}))::numeric AS max,',
|
' max(date_part(\'epoch\', {{=it._column}}))::numeric AS max,',
|
||||||
' avg(date_part(\'epoch\', {{=it._column}}))::numeric AS avg,',
|
' avg(date_part(\'epoch\', {{=it._column}}))::numeric AS avg,',
|
||||||
|
Loading…
Reference in New Issue
Block a user