MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Decode

Function Decode

pkg/util/vector/vector.go:126–140  ·  view source on GitHub ↗

Decode decodes the byte array into a vector and returns any remaining bytes.

(b []byte)

Source from the content-addressed store, hash-verified

124
125// Decode decodes the byte array into a vector and returns any remaining bytes.
126func Decode(b []byte) (remaining []byte, ret T, err error) {
127 var n uint32
128 b, n, err = encoding.DecodeUint32Ascending(b)
129 if err != nil {
130 return nil, nil, err
131 }
132 ret = make(T, n)
133 for i := range ret {
134 b, ret[i], err = encoding.DecodeUntaggedFloat32Value(b)
135 if err != nil {
136 return nil, nil, err
137 }
138 }
139 return b, ret, nil
140}
141
142// L1Distance returns the L1 (Manhattan) distance between t and t2.
143func L1Distance(t T, t2 T) (float64, error) {

Callers

nothing calls this directly

Calls 2

DecodeUint32AscendingFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…