MCPcopy Create free account
hub / github.com/brimdata/super / boolMaskRidx

Function boolMaskRidx

runtime/vam/expr/conditional.go:88–125  ·  view source on GitHub ↗
(ridx []uint32, bools, other *roaring.Bitmap, vec vector.Any)

Source from the content-addressed store, hash-verified

86}
87
88func boolMaskRidx(ridx []uint32, bools, other *roaring.Bitmap, vec vector.Any) {
89 switch vec := vec.(type) {
90 case *vector.Const:
91 if vec.Type().ID() != super.IDBool {
92 if ridx != nil {
93 other.AddMany(ridx)
94 } else {
95 other.AddRange(0, uint64(vec.Len()))
96 }
97 return
98 }
99 if !vector.BoolValue(vec, 0) {
100 return
101 }
102 if ridx != nil {
103 bools.AddMany(ridx)
104 } else {
105 bools.AddRange(0, uint64(vec.Len()))
106 }
107 case *vector.Bool:
108 trues := vec.Bits
109 if ridx != nil {
110 for i, idx := range ridx {
111 if trues.IsSetDirect(uint32(i)) {
112 bools.Add(idx)
113 }
114 }
115 } else {
116 bools.Or(roaring.FromDense(trues.GetBits(), true))
117 }
118 default:
119 if ridx != nil {
120 other.AddMany(ridx)
121 } else {
122 other.AddRange(0, uint64(vec.Len()))
123 }
124 }
125}

Callers 1

BoolMaskFunction · 0.85

Calls 7

BoolValueFunction · 0.92
IsSetDirectMethod · 0.80
GetBitsMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected