| 86 | } |
| 87 | |
| 88 | func 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 | } |