Cosmetic fix, as suggested in PR

This commit is contained in:
Rafa de la Torre 2018-02-12 19:24:53 +01:00
parent 065f56e161
commit 251fe96509

View File

@ -2,19 +2,17 @@ const BaseDataview = require('./base');
const debug = require('debug')('windshaft:dataview:aggregation');
const filteredQueryTpl = ctx => `
(
SELECT *
FROM (${ctx.query}) _cdb_filtered_source
${ctx.aggregationColumn && ctx.isFloatColumn ? `
WHERE
${ctx.aggregationColumn} != 'infinity'::float
AND
${ctx.aggregationColumn} != '-infinity'::float
AND
${ctx.aggregationColumn} != 'NaN'::float` :
''
}
) filtered_source
SELECT *
FROM (${ctx.query}) _cdb_filtered_source
${ctx.aggregationColumn && ctx.isFloatColumn ? `
WHERE
${ctx.aggregationColumn} != 'infinity'::float
AND
${ctx.aggregationColumn} != '-infinity'::float
AND
${ctx.aggregationColumn} != 'NaN'::float` :
''
}
`;
const summaryQueryTpl = ctx => `
@ -43,7 +41,7 @@ const rankedCategoriesQueryTpl = ctx => `
${ctx.column} AS category,
${ctx.aggregationFn} AS value,
row_number() OVER (ORDER BY ${ctx.aggregationFn} desc) as rank
FROM ${filteredQueryTpl(ctx)}
FROM (${filteredQueryTpl(ctx)}) filtered_source
${ctx.aggregationColumn !== null ? `WHERE ${ctx.aggregationColumn} IS NOT NULL` : ''}
GROUP BY ${ctx.column}
ORDER BY 2 DESC