From 8bb49e0e0881af80eea29142034fc18ee0abb70b Mon Sep 17 00:00:00 2001 From: Frank Bertsch Date: Fri, 12 Jan 2018 10:14:13 -0600 Subject: [PATCH] Make build_id insertions add histograms correctly Bug 1403994 Previously, old build_id histograms would merge with new ones by just adding; but instead we want to first add the histograms, then the sums and counts separately. Unfortunately this means that [0] did not fix historical build_id aggregates. Those are broken in the db for good. [0] https://github.com/mozilla/python_mozaggregator/pull/57 --- mozaggregator/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mozaggregator/sql.py b/mozaggregator/sql.py index 0ae34de..9fb4f40 100644 --- a/mozaggregator/sql.py +++ b/mozaggregator/sql.py @@ -53,7 +53,7 @@ begin -- Update existing tuples and delete matching rows from the staging table execute 'with merge as (update ' || tablename || ' as dest - set histogram = aggregate_arrays(dest.histogram, src.histogram) + set histogram = aggregate_histogram_arrays(dest.histogram, src.histogram) from ' || stage_table || ' as src where dest.dimensions = src.dimensions returning dest.*)