Commit 367f08e
authored
IN LIST: unify bitmap filter implementations (apache#23035)
## Which issue does this PR close?
- Part of apache#19241.
- Stacked on apache#23012.
- Next in stack: apache#23013.
- Extracted from apache#19390.
## Rationale for this change
apache#23011 and apache#23012 intentionally introduce the `UInt8` and `UInt16`
bitmap filters as concrete implementations. With both widths visible,
the shared shape is now clear: each filter builds a fixed-size bitmap
from non-null `IN` list values and probes it with the input value's
integer bit pattern.
This PR factors that duplicated bitmap machinery into one
`BitmapFilter<T>`, where `T` is the Arrow primitive type (`UInt8Type` or
`UInt16Type`). Arrow remains the source of truth for the native Rust
value through `T::Native`; the only extra type-specific piece is the
bitmap storage size, supplied by a small private `BitmapFilterType`
trait implemented for those two Arrow types.
This does not add a new lookup strategy or change which data types use
bitmap filters. The next PR uses this shared shape to let same-width
signed integers reuse the unsigned bitmap storage.
## What changes are included in this PR?
- Adds `BitmapStorage` for fixed-size bitmap backing stores.
- Adds `BitmapFilterType`, a private extension trait that supplies the
bitmap storage size for `UInt8Type` and `UInt16Type`.
- Replaces the concrete `UInt8BitmapFilter` and `UInt16BitmapFilter`
implementations with `BitmapFilter<T>`.
- Uses Arrow's `T::Native` directly when setting and checking bit
positions.
- Keeps `UInt8` and `UInt16` routing behavior unchanged.
## Are these changes tested?
Yes.
- `cargo fmt --all`
- `cargo test -p datafusion-physical-expr bitmap_filter_ --lib`
- `cargo test -p datafusion-physical-expr in_list_int_types --lib`
- `cargo test -p datafusion-physical-expr
test_in_list_from_array_type_combinations --lib`
- `cargo test -p datafusion-physical-expr test_in_list_dictionary_types
--lib`
- `cargo clippy -p datafusion-physical-expr --all-targets --all-features
-- -D warnings`
## Are there any user-facing changes?
No. This is an internal refactor only.
<!-- codex-benchmark-start -->
## Benchmark note
No local benchmark numbers are included for this PR because it is
intended to be a behavior-preserving refactor of the bitmap filter
implementation. Benchmarks were not rerun for this stack split.
<!-- codex-benchmark-end -->1 parent 951b821 commit 367f08e
2 files changed
Lines changed: 86 additions & 91 deletions
Lines changed: 83 additions & 88 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
71 | 53 | | |
72 | | - | |
73 | 54 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 55 | + | |
| 56 | + | |
77 | 57 | | |
78 | 58 | | |
79 | 59 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
83 | 67 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
104 | 75 | | |
105 | 76 | | |
106 | 77 | | |
107 | | - | |
| 78 | + | |
108 | 79 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
112 | 107 | | |
113 | | - | |
| 108 | + | |
114 | 109 | | |
115 | 110 | | |
116 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
117 | 115 | | |
118 | | - | |
119 | | - | |
| 116 | + | |
| 117 | + | |
120 | 118 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 119 | + | |
127 | 120 | | |
128 | 121 | | |
129 | 122 | | |
130 | 123 | | |
131 | | - | |
| 124 | + | |
132 | 125 | | |
133 | 126 | | |
134 | 127 | | |
135 | 128 | | |
136 | 129 | | |
137 | 130 | | |
138 | | - | |
| 131 | + | |
139 | 132 | | |
140 | 133 | | |
141 | 134 | | |
| |||
146 | 139 | | |
147 | 140 | | |
148 | 141 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 142 | + | |
| 143 | + | |
152 | 144 | | |
153 | 145 | | |
154 | 146 | | |
155 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
156 | 151 | | |
157 | 152 | | |
158 | 153 | | |
159 | 154 | | |
160 | 155 | | |
161 | 156 | | |
162 | | - | |
163 | | - | |
| 157 | + | |
| 158 | + | |
164 | 159 | | |
165 | 160 | | |
166 | 161 | | |
| |||
406 | 401 | | |
407 | 402 | | |
408 | 403 | | |
409 | | - | |
| 404 | + | |
410 | 405 | | |
411 | 406 | | |
412 | 407 | | |
| |||
421 | 416 | | |
422 | 417 | | |
423 | 418 | | |
424 | | - | |
| 419 | + | |
425 | 420 | | |
426 | 421 | | |
427 | 422 | | |
| |||
438 | 433 | | |
439 | 434 | | |
440 | 435 | | |
441 | | - | |
| 436 | + | |
442 | 437 | | |
443 | 438 | | |
444 | 439 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
0 commit comments