dont order for aggregate

This commit is contained in:
Sven Klemm 2018-08-03 10:15:28 +02:00
parent dabfd88cd9
commit aa830211fe
2 changed files with 3 additions and 7 deletions

View File

@ -151,11 +151,7 @@ export default class PostgresQuery {
if (func === 'first' || func === 'last') {
query = func + '(' + query + ',' + this.target.timeColumn + ')';
} else {
if (windows) {
query = func + '(' + query + ' ORDER BY ' + this.target.timeColumn + ')';
} else {
query = func + '(' + query + ')';
}
query = func + '(' + query + ')';
}
break;
case 'percentile':

View File

@ -98,8 +98,8 @@ describe('PostgresQuery', function() {
{ type: 'window', params: ['increase'] },
];
expect(query.buildValueColumn(column)).toBe(
'(CASE WHEN max(v ORDER BY time) >= lag(max(v ORDER BY time)) OVER (PARTITION BY host ORDER BY time) ' +
'THEN max(v ORDER BY time) - lag(max(v ORDER BY time)) OVER (PARTITION BY host ORDER BY time) ELSE max(v ORDER BY time) END) AS "a"'
'(CASE WHEN max(v) >= lag(max(v)) OVER (PARTITION BY host ORDER BY time) ' +
'THEN max(v) - lag(max(v)) OVER (PARTITION BY host ORDER BY time) ELSE max(v) END) AS "a"'
);
});