Skip to content

Commit

Permalink
Drop intern package and lift method to parquetquery package
Browse files Browse the repository at this point in the history
  • Loading branch information
zalegrala committed Nov 4, 2024
1 parent 09b0809 commit 76876fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 105 deletions.
28 changes: 0 additions & 28 deletions pkg/parquetquery/intern/intern.go

This file was deleted.

72 changes: 0 additions & 72 deletions pkg/parquetquery/intern/intern_test.go

This file was deleted.

17 changes: 12 additions & 5 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 = pqValueIntern(v)
} else {
c.at.Entries[0].Value = v.Clone()
}
Expand All @@ -1257,6 +1255,15 @@ func (c *SyncIterator) makeResult(t RowNumber, v *pq.Value) *IteratorResult {
return &c.at
}

func pqValueIntern(v *pq.Value) pq.Value {
switch v.Kind() {
case pq.ByteArray, pq.FixedLenByteArray:
return *unique.Make(v).Value()
default:
return *v
}
}

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

Expand Down

0 comments on commit 76876fe

Please sign in to comment.