Skip to content

Commit

Permalink
Replace *pq.Value interning with unique package
Browse files Browse the repository at this point in the history
  • Loading branch information
zalegrala committed Nov 1, 2024
1 parent e19ab71 commit fc55642
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/parquetquery/iters.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"math"
"sync"
"sync/atomic"
"unique"

"github.com/grafana/tempo/pkg/parquetquery/intern"
"github.com/grafana/tempo/pkg/util"
pq "github.com/parquet-go/parquet-go"
"go.opentelemetry.io/otel"
Expand Down Expand Up @@ -781,7 +781,6 @@ type SyncIteratorOpt func(*SyncIterator)
func SyncIteratorOptIntern() SyncIteratorOpt {
return func(i *SyncIterator) {
i.intern = true
i.interner = intern.New()
}
}

Expand Down Expand Up @@ -814,8 +813,7 @@ type SyncIterator struct {
currPageN int
at IteratorResult // Current value pointed at by iterator. Returned by call Next and SeekTo, valid until next call.

intern bool
interner *intern.Interner
intern bool
}

var _ Iterator = (*SyncIterator)(nil)
Expand Down Expand Up @@ -1248,7 +1246,7 @@ func (c *SyncIterator) makeResult(t RowNumber, v *pq.Value) *IteratorResult {
// always have length 0 or 1.
if len(c.at.Entries) == 1 {
if c.intern {
c.at.Entries[0].Value = c.interner.UnsafeClone(v)
c.at.Entries[0].Value = *unique.Make(v).Value()
} else {
c.at.Entries[0].Value = v.Clone()
}
Expand All @@ -1259,12 +1257,7 @@ func (c *SyncIterator) makeResult(t RowNumber, v *pq.Value) *IteratorResult {

func (c *SyncIterator) Close() {
c.closeCurrRowGroup()

c.span.End()

if c.intern && c.interner != nil {
c.interner.Close()
}
}

// ColumnIterator asynchronously iterates through the given row groups and column. Applies
Expand Down

0 comments on commit fc55642

Please sign in to comment.