PanelQueryRunner: Shallow diff series DataFrames (#79257)

This commit is contained in:
Leon Sorokin 2023-12-12 16:11:17 -06:00 committed by GitHub
parent 0c1d1c6b6e
commit 19cda38f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -336,9 +336,30 @@ export class PanelQueryRunner {
this.subscription = panelData.subscribe({ this.subscription = panelData.subscribe({
next: (data) => { next: (data) => {
this.lastResult = skipPreProcess ? data : preProcessPanelData(data, this.lastResult); const last = this.lastResult;
const next = skipPreProcess ? data : preProcessPanelData(data, last);
if (last != null) {
let sameSeries = compareArrayValues(last.series ?? [], next.series ?? [], (a, b) => a === b);
let sameAnnotations = compareArrayValues(last.annotations ?? [], next.annotations ?? [], (a, b) => a === b);
if (sameSeries) {
next.series = last.series;
}
if (sameAnnotations) {
next.annotations = last.annotations;
}
if (sameSeries && sameAnnotations) {
return;
}
}
this.lastResult = next;
// Store preprocessed query results for applying overrides later on in the pipeline // Store preprocessed query results for applying overrides later on in the pipeline
this.subject.next(this.lastResult); this.subject.next(next);
}, },
}); });
} }