@@ -49,6 +49,21 @@ impl BitmapStorage for [u64; 4] {
4949 }
5050}
5151
52+ impl BitmapStorage for Box < [ u64 ; 1024 ] > {
53+ #[ inline]
54+ fn new_zeroed ( ) -> Self {
55+ Box :: new ( [ 0u64 ; 1024 ] )
56+ }
57+ #[ inline]
58+ fn set_bit ( & mut self , index : usize ) {
59+ self [ index / 64 ] |= 1u64 << ( index % 64 ) ;
60+ }
61+ #[ inline( always) ]
62+ fn get_bit ( & self , index : usize ) -> bool {
63+ ( self [ index / 64 ] >> ( index % 64 ) ) & 1 != 0
64+ }
65+ }
66+
5267pub ( super ) trait BitmapFilterConfig : Send + Sync + ' static {
5368 const DATA_TYPE_NAME : & ' static str ;
5469
@@ -73,10 +88,24 @@ impl BitmapFilterConfig for UInt8BitmapConfig {
7388 }
7489}
7590
91+ pub ( super ) enum UInt16BitmapConfig { }
92+ impl BitmapFilterConfig for UInt16BitmapConfig {
93+ const DATA_TYPE_NAME : & ' static str = "UInt16" ;
94+
95+ type Native = u16 ;
96+ type ArrowType = UInt16Type ;
97+ type Storage = Box < [ u64 ; 1024 ] > ;
98+
99+ #[ inline( always) ]
100+ fn to_index ( v : u16 ) -> usize {
101+ v as usize
102+ }
103+ }
104+
76105/// Bitmap filter for O(1) set membership via single bit test.
77106///
78- /// `UInt8` has only 256 possible values, so the filter stores membership in a
79- /// 256-bit bitmap instead of using a hash table.
107+ /// Small integer domains can store membership in a fixed-size bitmap instead
108+ /// of using a hash table.
80109pub ( super ) struct BitmapFilter < C : BitmapFilterConfig > {
81110 null_count : usize ,
82111 bits : C :: Storage ,
@@ -321,7 +350,6 @@ primitive_static_filter!(Int8StaticFilter, Int8Type);
321350primitive_static_filter ! ( Int16StaticFilter , Int16Type ) ;
322351primitive_static_filter ! ( Int32StaticFilter , Int32Type ) ;
323352primitive_static_filter ! ( Int64StaticFilter , Int64Type ) ;
324- primitive_static_filter ! ( UInt16StaticFilter , UInt16Type ) ;
325353primitive_static_filter ! ( UInt32StaticFilter , UInt32Type ) ;
326354primitive_static_filter ! ( UInt64StaticFilter , UInt64Type ) ;
327355
0 commit comments