diff --git a/lib/cartodb/models/dataview/overviews/aggregation.js b/lib/cartodb/models/dataview/overviews/aggregation.js index 1b0e2ec6..cc95e73c 100644 --- a/lib/cartodb/models/dataview/overviews/aggregation.js +++ b/lib/cartodb/models/dataview/overviews/aggregation.js @@ -60,7 +60,7 @@ var categoriesSummaryCountQueryTpl = dot.template([ ' SELECT count(1) AS categories_count', ' FROM (', ' SELECT {{=it._column}} AS category', - ' FROM ({{=it._query}}) _cdb_categories', + ' FROM filtered_source', ' GROUP BY {{=it._column}}', ' ) _cdb_categories_count', ')' @@ -82,7 +82,7 @@ var rankedAggregationQueryTpl = dot.template([ var aggregationQueryTpl = dot.template([ 'SELECT CAST({{=it._column}} AS text) AS category, {{=it._aggregation}} AS value, false as agg,', ' nulls_count, min_val, max_val, count, categories_count, nans_count, infinities_count', - 'FROM ({{=it._query}}) _cdb_aggregation_all, summary, categories_summary_min_max, categories_summary_count', + 'FROM filtered_source, summary, categories_summary_min_max, categories_summary_count', 'GROUP BY category, nulls_count, min_val, max_val, count, categories_count, nans_count, infinities_count', 'ORDER BY value DESC' ].join('\n')); diff --git a/test/acceptance/dataviews/overviews.js b/test/acceptance/dataviews/overviews.js index c822caee..08ee6b7c 100644 --- a/test/acceptance/dataviews/overviews.js +++ b/test/acceptance/dataviews/overviews.js @@ -505,7 +505,7 @@ describe('dataviews using tables with overviews', function() { describe('aggregation special float values', function () { var params = {}; - it("should expose an aggregation dataview", function (done) { + it("should expose an aggregation dataview filtering special float values out", function (done) { var testClient = new TestClient(overviewsMapConfig); testClient.getDataview('test_categories_special_values', params, function (err, dataview) { if (err) { @@ -519,12 +519,8 @@ describe('dataviews using tables with overviews', function() { infinities: 1, min: 6, max: 6, - categoriesCount: 3, - categories:[ - { category: 'El Rey del Tallarín', value: null, agg: false }, - { category: 'El Lacón', value: null, agg: false }, - { category: 'Hawai', value: 6, agg: false } - ], + categoriesCount: 1, + categories: [ { category: 'Hawai', value: 6, agg: false } ], type: 'aggregation' }); testClient.drain(done);