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
This commit is contained in:
Frank Bertsch 2018-01-12 10:14:13 -06:00
Родитель 7dd4259ba6
Коммит 8bb49e0e08
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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.*)