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

Method CopyWithReorderedSource

pkg/col/coldata/vec.eg.go:926–1288  ·  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

924// Resulting values of elements not mentioned in sel are undefined after
925// this function.
926func (v *Vec) CopyWithReorderedSource(src *Vec, sel, order []int) {
927 if len(sel) == 0 {
928 return
929 }
930 if v.nulls.MaybeHasNulls() {
931 v.nulls.UnsetNulls()
932 }
933 switch v.CanonicalTypeFamily() {
934 case types.BoolFamily:
935 switch v.t.Width() {
936 case -1:
937 default:
938 fromCol := src.Bool()
939 toCol := v.Bool()
940 n := len(sel)
941 _ = sel[n-1]
942 if src.MaybeHasNulls() {
943 nulls := src.Nulls()
944 for i := 0; i < n; i++ {
945 //gcassert:bce
946 destIdx := sel[i]
947 srcIdx := order[destIdx]
948 if nulls.NullAt(srcIdx) {
949 v.nulls.SetNull(destIdx)
950 } else {
951 v := fromCol.Get(srcIdx)
952 toCol.Set(destIdx, v)
953 }
954 }
955 } else {
956 for i := 0; i < n; i++ {
957 //gcassert:bce
958 destIdx := sel[i]
959 srcIdx := order[destIdx]
960 {
961 v := fromCol.Get(srcIdx)
962 toCol.Set(destIdx, v)
963 }
964 }
965 }
966 }
967 case types.BytesFamily:
968 switch v.t.Width() {
969 case -1:
970 default:
971 fromCol := src.Bytes()
972 toCol := v.Bytes()
973 n := len(sel)
974 _ = sel[n-1]
975 if src.MaybeHasNulls() {
976 nulls := src.Nulls()
977 for i := 0; i < n; i++ {
978 //gcassert:bce
979 destIdx := sel[i]
980 srcIdx := order[destIdx]
981 if nulls.NullAt(srcIdx) {
982 v.nulls.SetNull(destIdx)
983 } else {

Callers

nothing calls this directly

Calls 15

CanonicalTypeFamilyMethod · 0.95
BoolMethod · 0.95
BytesMethod · 0.95
DecimalMethod · 0.95
Int16Method · 0.95
Int32Method · 0.95
Int64Method · 0.95
Float64Method · 0.95
TimestampMethod · 0.95
IntervalMethod · 0.95
JSONMethod · 0.95
DatumMethod · 0.95

Tested by

no test coverage detected