Prefix nans and infinities counters to avoid name collision

This commit is contained in:
Daniel García Aubert 2017-08-08 09:54:49 +02:00
parent c7e5dbf158
commit cf71489a7f

View File

@ -133,7 +133,7 @@ var nullsQueryTpl = dot.template([
var infinitiesQueryTpl = dot.template([
'__cdb_infinities AS (',
' SELECT',
' count(*) AS infinities_count',
' count(*) AS __cdb_infinities_count',
' FROM ({{=it._query}}) __cdb_infinities_query',
' WHERE',
' {{=it._column}} = \'infinity\'::float',
@ -143,9 +143,9 @@ var infinitiesQueryTpl = dot.template([
].join('\n'));
var nansQueryTpl = dot.template([
'nans AS (',
'__cdb_nans AS (',
' SELECT',
' count(*) AS nans_count',
' count(*) AS __cdb_nans_count',
' FROM ({{=it._query}}) __cdb_nans_query',
' WHERE {{=it._column}} = \'NaN\'::float',
')'
@ -156,8 +156,8 @@ var histogramQueryTpl = dot.template([
' (max_val - min_val) / cast(__cdb_bins_number as float) AS bin_width,',
' __cdb_bins_number AS bins_number,',
' __cdb_nulls_count AS nulls_count,',
' {{?it._isFloatColumn}}infinities_count,',
' nans_count,{{?}}',
' {{?it._isFloatColumn}}__cdb_infinities_count AS infinities_count,',
' __cdb_nans_count AS nans_count,{{?}}',
' avg_val,',
' CASE WHEN min_val = max_val',
' THEN 0',
@ -173,7 +173,7 @@ var histogramQueryTpl = dot.template([
' max({{=it._column}})::numeric AS max,',
' avg({{=it._column}})::numeric AS avg,',
' count(*) AS freq',
'FROM __cdb_filtered_source, __cdb_basics, __cdb_nulls, __cdb_bins{{?it._isFloatColumn}}, __cdb_infinities, nans{{?}}',
'FROM __cdb_filtered_source, __cdb_basics, __cdb_nulls, __cdb_bins{{?it._isFloatColumn}}, __cdb_infinities, __cdb_nans{{?}}',
'GROUP BY bin, bins_number, bin_width, nulls_count,',
' avg_val{{?it._isFloatColumn}}, infinities_count, nans_count{{?}}',
'ORDER BY bin'