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

Method CopyWithReorderedSource

pkg/col/coldata/vec_tmpl.go:313–342  ·  view source on GitHub ↗

*/}} CopyWithReorderedSource copies a value at position order[sel[i]] in src into the receiver at position sel[i]. len(sel) elements are copied. Resulting values of elements not mentioned in sel are undefined after this function.

(src *Vec, sel, order []int)

Source from the content-addressed store, hash-verified

311// Resulting values of elements not mentioned in sel are undefined after
312// this function.
313func (v *Vec) CopyWithReorderedSource(src *Vec, sel, order []int) {
314 if len(sel) == 0 {
315 return
316 }
317 if v.nulls.MaybeHasNulls() {
318 v.nulls.UnsetNulls()
319 }
320 switch v.CanonicalTypeFamily() {
321 // {{range .}}
322 case _CANONICAL_TYPE_FAMILY:
323 switch v.t.Width() {
324 // {{range .WidthOverloads}}
325 case _TYPE_WIDTH:
326 fromCol := src.TemplateType()
327 toCol := v.TemplateType()
328 n := len(sel)
329 _ = sel[n-1]
330 if src.MaybeHasNulls() {
331 nulls := src.Nulls()
332 _COPY_WITH_REORDERED_SOURCE(true)
333 } else {
334 _COPY_WITH_REORDERED_SOURCE(false)
335 }
336 // {{end}}
337 }
338 // {{end}}
339 default:
340 panic(fmt.Sprintf("unhandled type %s", v.t))
341 }
342}
343
344// Window returns a "window" into the Vec. A "window" is similar to Golang's
345// slice of the current Vec from [start, end), but the returned object is NOT

Callers

nothing calls this directly

Calls 7

CanonicalTypeFamilyMethod · 0.95
TemplateTypeMethod · 0.95
UnsetNullsMethod · 0.80
NullsMethod · 0.80
WidthMethod · 0.65
MaybeHasNullsMethod · 0.45

Tested by

no test coverage detected