From 41d0d9f8c10531d94a4f7ae523ad74997e1e9f9e Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Fri, 3 Jan 2025 18:17:17 +0100 Subject: [PATCH] execution: initialize next in aggregation even if we aggregate the labels away (#504) * execution: initialize next in aggregation even if we aggregate the labels away Signed-off-by: Michael Hoffmann * execute: review on execution/aggregate/hashaggregate.go Co-authored-by: Filip Petkovski Signed-off-by: Michael Hoffmann --------- Signed-off-by: Michael Hoffmann Signed-off-by: Michael Hoffmann Co-authored-by: Michael Hoffmann Co-authored-by: Filip Petkovski --- execution/aggregate/hashaggregate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/execution/aggregate/hashaggregate.go b/execution/aggregate/hashaggregate.go index 62da9f5d..9d4fc469 100644 --- a/execution/aggregate/hashaggregate.go +++ b/execution/aggregate/hashaggregate.go @@ -220,6 +220,10 @@ func (a *aggregate) initializeTables(ctx context.Context) error { } func (a *aggregate) initializeVectorizedTables(ctx context.Context) ([]aggregateTable, []labels.Labels, error) { + // perform initialization of the underlying operator even if we are aggregating the labels away + if _, err := a.next.Series(ctx); err != nil { + return nil, nil, err + } tables, err := newVectorizedTables(a.stepsBatch, a.aggregation) if errors.Is(err, parse.ErrNotSupportedExpr) { return a.initializeScalarTables(ctx)