Use proper mode

This commit is contained in:
Raul Marin 2019-07-08 16:27:31 +02:00
parent 262f957218
commit d3e807583a
2 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ const SUPPORTED_AGGREGATE_FUNCTIONS = {
sql: (column_name, params) => `max(${params.aggregated_column || column_name})`
},
'mode': {
sql: (column_name, params) => `_cdb_mode(${params.aggregated_column || column_name})`
sql: (column_name, params) => `mode() WITHIN GROUP (ORDER BY ${params.aggregated_column || column_name})`
}
};

View File

@ -2354,7 +2354,7 @@ describe('aggregation', function () {
threshold: 1,
columns: {
value: {
aggregate_function: 'sum',
aggregate_function: 'mode',
aggregated_column: 'value'
}
},
@ -2400,7 +2400,7 @@ describe('aggregation', function () {
threshold: 1,
columns: {
value: {
aggregate_function: 'sum',
aggregate_function: 'mode',
aggregated_column: 'value'
}
},