Aggregation function MAX

This commit is contained in:
Oleksii Oleksenko
2020-06-25 16:05:27 +02:00
parent 57aba2efd1
commit 976902dee1
6 changed files with 18 additions and 2 deletions

View File

@@ -659,6 +659,14 @@ int64_t get_aggregate_value_100(int64_t* values, size_t length) {
}
}
return min * 100;
} else if (aggregate_function == MAX) {
int64_t max = values[0];
for (int i=0; i<length; i++) {
if (values[i] > max) {
max = values[i];
}
}
return max * 100;
} else {
qsort(values, length, sizeof(int64_t), cmpInt64);

View File

@@ -107,7 +107,7 @@ extern int no_mem;
extern int basic_mode;
#define BASIC_MODE_DEFAULT 0;
enum agg_enum {AVG_20_80, MIN, MED};
enum agg_enum {AVG_20_80, MIN, MAX, MED};
extern int aggregate_function;
#define AGGREGATE_FUNCTION_DEFAULT AVG_20_80;