MCPcopy
hub / github.com/grafana/tempo / UnsafeClone

Method UnsafeClone

pkg/parquetquery/intern/intern.go:27–37  ·  view source on GitHub ↗
(v *pq.Value)

Source from the content-addressed store, hash-verified

25}
26
27func (i *Interner) UnsafeClone(v *pq.Value) pq.Value {
28 switch v.Kind() {
29 case pq.ByteArray, pq.FixedLenByteArray:
30 // This is unsafe but validated by tests.
31 a := *(*pqValue)(unsafe.Pointer(v))
32 a.ptr = addressOfBytes(i.internBytes(a.byteArray()))
33 return *(*pq.Value)(unsafe.Pointer(&a))
34 default:
35 return *v
36 }
37}
38
39func (i *Interner) internBytes(b []byte) []byte {
40 if x, ok := i.m[bytesToString(b)]; ok {

Callers 3

makeResultInternMethod · 0.80
TestInterner_UnsafeCloneFunction · 0.80
BenchmarkInternFunction · 0.80

Calls 4

internBytesMethod · 0.95
addressOfBytesFunction · 0.85
KindMethod · 0.80
byteArrayMethod · 0.80

Tested by 2

TestInterner_UnsafeCloneFunction · 0.64
BenchmarkInternFunction · 0.64