Compute the intersection of multiple bitmaps.
| 36 | |
| 37 | /// Compute the intersection of multiple bitmaps. |
| 38 | void BitMapAccumulator::IntersectBitMaps(uint8_t* dst_map, |
| 39 | const std::vector<const uint8_t*>& src_maps, |
| 40 | const std::vector<int64_t>& src_map_offsets, |
| 41 | int64_t num_records) { |
| 42 | int64_t num_words = (num_records + 63) / 64; // aligned to 8-byte. |
| 43 | int64_t num_bytes = num_words * 8; |
| 44 | int64_t nmaps = src_maps.size(); |
| 45 | |
| 46 | switch (nmaps) { |
| 47 | case 0: { |
| 48 | // no src_maps_ bitmap. simply set all bits |
| 49 | memset(dst_map, 0xff, num_bytes); |
| 50 | break; |
| 51 | } |
| 52 | |
| 53 | case 1: { |
| 54 | // one src_maps_ bitmap. copy to dst_map |
| 55 | arrow::internal::CopyBitmap(src_maps[0], src_map_offsets[0], num_records, dst_map, |
| 56 | 0); |
| 57 | break; |
| 58 | } |
| 59 | |
| 60 | default: { |
| 61 | // src_maps bitmaps ANDs |
| 62 | arrow::internal::BitmapAnd(src_maps[0], src_map_offsets[0], src_maps[1], |
| 63 | src_map_offsets[1], num_records, /*offset=*/0, dst_map); |
| 64 | for (int64_t m = 2; m < nmaps; ++m) { |
| 65 | arrow::internal::BitmapAnd(dst_map, 0, src_maps[m], src_map_offsets[m], |
| 66 | num_records, |
| 67 | /*offset=*/0, dst_map); |
| 68 | } |
| 69 | |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | } // namespace gandiva |
nothing calls this directly
no test coverage detected