Closed dgaubert closed 5 years ago
Pease @CartoDB/rt-managers, give to this issue max priority
to this bug as Tilers are crashing because of this.
@alrocar @esloho labeling this critical per @dgaubert comment above
@dgaubert the function that should validate the aggregation is getAggregationSql
:
var aggregationFnQueryTpl = {
count: dot.template('sum(_feature_count)'),
sum: dot.template('sum({{=it._aggregationColumn}}*_feature_count)')
};
Aggregation.prototype.getAggregationSql = function() {
return aggregationFnQueryTpl[this.aggregation]({
_aggregationFn: this.aggregation,
_aggregationColumn: this.aggregationColumn || 1
});
};
what should be the expected return of this function when this.aggregation
is missing? Null? empty object? Error?
We should validate this. aggregation
is either count
or sum
, otherwise, we should throw an error in the same way we do for regular aggregations, see: https://github.com/CartoDB/Windshaft-cartodb/blob/master/lib/models/dataview/aggregation.js#L197.
Please add some tests here to validate the new behaviour.
HTH
From logs:
We should validate the aggregation method.