Extract template to filter out special numeric values

This commit is contained in:
Daniel García Aubert 2017-09-05 10:36:18 +02:00
parent 6373fe8652
commit c580600590

View File

@ -51,22 +51,23 @@ var MAX_INTERVAL_VALUE = 366;
var BIN_MIN_NUMBER = 6;
var BIN_MAX_NUMBER = 48;
const filterOutSpecialNumericValues = ctx => `
${ctx._column} != 'infinity'::float
AND
${ctx._column} != '-infinity'::float
AND
${ctx._column} != 'NaN'::float
`;
const filteredQueryTpl = ctx => `
__cdb_filtered_source AS (
SELECT *
FROM (${ctx._query}) __cdb_filtered_source_query
WHERE
${ctx._column} IS NOT NULL
${ctx._isFloatColumn ? `
AND
${ctx._column} != 'infinity'::float
AND
${ctx._column} != '-infinity'::float
AND
${ctx._column} != 'NaN'::float
` : ''}
WHERE ${ctx._column} IS NOT NULL
${ctx._isFloatColumn ? `AND ${filterOutSpecialNumericValues(ctx)}` : ''}
)
`
`;
var basicsQueryTpl = dot.template([
'__cdb_basics AS (',
' SELECT',