Skip to content

Commit 0ad0329

Browse files
Haoning-Sunhaoning.sun
authored andcommitted
Reinitialize columnIndices and labelColumnIndices for each record
1 parent 1e7632a commit 0ad0329

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

pkg/parcacol/querier.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -508,25 +508,24 @@ func (q *Querier) queryRangeDelta(
508508
)
509509
}
510510

511-
// Add necessary columns and their found value is false by default.
512-
columnIndices := struct {
513-
Timestamp int
514-
PerSecondValue int
515-
ValueSum int
516-
Duration int
517-
}{
518-
Timestamp: -1,
519-
PerSecondValue: -1,
520-
ValueSum: -1,
521-
Duration: -1,
522-
}
523-
524-
labelColumnIndices := []int{}
525511
labelSet := labels.NewScratchBuilder(64)
526512
resSeries := []*pb.MetricsSeries{}
527513
labelsetToIndex := map[string]int{}
528514

529515
for _, ar := range records {
516+
// Add necessary columns and their found value is false by default.
517+
columnIndices := struct {
518+
Timestamp int
519+
PerSecondValue int
520+
ValueSum int
521+
Duration int
522+
}{
523+
Timestamp: -1,
524+
PerSecondValue: -1,
525+
ValueSum: -1,
526+
Duration: -1,
527+
}
528+
labelColumnIndices := []int{}
530529
fields := ar.Schema().Fields()
531530
for i, field := range fields {
532531
switch field.Name {
@@ -678,18 +677,18 @@ func (q *Querier) queryRangeNonDelta(ctx context.Context, filterExpr logicalplan
678677
index int
679678
found bool
680679
}
681-
// Add necessary columns and their found value is false by default.
682-
columnIndices := map[string]columnIndex{
683-
profile.ColumnTimeNanos: {},
684-
valueSumColumn: {},
685-
}
686-
labelColumnIndices := []int{}
687680
labelSet := labels.NewScratchBuilder(64)
688681
resSeries := []*pb.MetricsSeries{}
689682
resSeriesBuckets := map[int]map[int64]struct{}{}
690683
labelsetToIndex := map[string]int{}
691684

692685
for _, ar := range records {
686+
// Add necessary columns and their found value is false by default.
687+
columnIndices := map[string]columnIndex{
688+
profile.ColumnTimeNanos: {},
689+
valueSumColumn: {},
690+
}
691+
labelColumnIndices := []int{}
693692
fields := ar.Schema().Fields()
694693
for i, field := range fields {
695694
if _, ok := columnIndices[field.Name]; ok {

0 commit comments

Comments
 (0)