Skip to content

Commit

Permalink
fixing initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
  • Loading branch information
pedro-stanaka committed Apr 10, 2024
1 parent fa657b0 commit ab737ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/dedup/iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func newDedupSeriesIterator(a, b adjustableSeriesIterator) *dedupSeriesIterator
a: a,
b: b,
lastT: math.MinInt64,
lastIter: nil,
lastIter: a,
useA: true,
aval: a.Next(),
bval: b.Next(),
Expand Down Expand Up @@ -372,11 +372,11 @@ func (it *dedupSeriesIterator) Next() chunkenc.ValueType {

func (it *dedupSeriesIterator) lastFloatVal() (float64, bool) {
if it.useA && it.aval == chunkenc.ValFloat {
_, v := it.a.At()
_, v := it.lastIter.At()
return v, true
}
if !it.useA && it.bval == chunkenc.ValFloat {
_, v := it.b.At()
_, v := it.lastIter.At()
return v, true
}
return 0, false
Expand Down
7 changes: 7 additions & 0 deletions pkg/dedup/iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,13 @@ func TestDedupSeriesIterator_NativeHistograms(t *testing.T) {
)
res := expandHistogramSeries(t, noopAdjustableSeriesIterator{it})
require.EqualValues(t, c.exp, res)

it = newDedupSeriesIterator(
noopAdjustableSeriesIterator{newMockedSeriesIterator(c.a)},
noopAdjustableSeriesIterator{testiters.NewHistogramIterator(c.b)},
)
res = expandHistogramSeries(t, noopAdjustableSeriesIterator{it})
require.EqualValues(t, c.exp, res)
}
}

Expand Down

0 comments on commit ab737ff

Please sign in to comment.