summaryrefslogtreecommitdiffstats
path: root/web/api/queries
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2018-10-25 16:32:12 +0300
committerGitHub <noreply@github.com>2018-10-25 16:32:12 +0300
commit652654c1acab4c748ad54f7ed0e871921dd046e2 (patch)
treec722d46909a79e437600bbe66f701f057307e4f6 /web/api/queries
parentf8001c4a7c50d6756a21b37ce77ab7ef2e73cc44 (diff)
restored min-max calculation of RRDR (#4489)
Diffstat (limited to 'web/api/queries')
-rw-r--r--web/api/queries/query.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/web/api/queries/query.c b/web/api/queries/query.c
index 1806b6d4e9..b157d2a962 100644
--- a/web/api/queries/query.c
+++ b/web/api/queries/query.c
@@ -408,6 +408,7 @@ static inline void do_dimension(
RRDR_VALUE_FLAGS
group_value_flags = RRDR_VALUE_NOTHING;
+ calculated_number min = NAN, max = NAN;
size_t db_points_read = 0;
for( ; points_added < points_wanted ; now += dt, slot++ ) {
if(unlikely(slot >= entries)) slot = 0;
@@ -462,7 +463,15 @@ static inline void do_dimension(
*rrdr_value_options_ptr = group_value_flags;
// store the value
- r->v[rrdr_line * r->d + dim_id_in_rrdr] = r->internal.grouping_flush(r, rrdr_value_options_ptr);
+ calculated_number value = r->internal.grouping_flush(r, rrdr_value_options_ptr);
+ r->v[rrdr_line * r->d + dim_id_in_rrdr] = value;
+
+ if(likely(points_added)) {
+ if(unlikely(value < min)) min = value;
+ if(unlikely(value > max)) max = value;
+ }
+ else
+ min = max = value;
points_added++;
values_in_group = 0;
@@ -474,6 +483,8 @@ static inline void do_dimension(
r->internal.db_points_read += db_points_read;
r->internal.result_points_generated += points_added;
+ r->min = min;
+ r->max = max;
r->before = max_date;
r->after = min_date;
rrdr_done(r, rrdr_line);