Always add a _cdb_feature_count to aggregated queries
This commit is contained in:
@@ -50,16 +50,11 @@ const SUPPORTED_AGGREGATE_FUNCTIONS = {
|
||||
};
|
||||
|
||||
const aggregateColumns = ctx => {
|
||||
// TODO: always add count
|
||||
let columns = ctx.columns || {};
|
||||
if (Object.keys(columns).length === 0) {
|
||||
// default aggregation
|
||||
columns = {
|
||||
_cdb_feature_count: {
|
||||
aggregate_function: 'count'
|
||||
}
|
||||
};
|
||||
}
|
||||
let columns = Object.assign({
|
||||
_cdb_feature_count: {
|
||||
aggregate_function: 'count'
|
||||
}
|
||||
}, ctx.columns || {});
|
||||
return Object.keys(columns).map(column_name => {
|
||||
const aggregate_function = columns[column_name].aggregate_function || 'count';
|
||||
const aggregate_definition = SUPPORTED_AGGREGATE_FUNCTIONS[aggregate_function];
|
||||
|
||||
Reference in New Issue
Block a user