File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -121,12 +121,24 @@ impl RowMask {
121121
122122 /// Combine the RowMask with bitmask values resulting in new RowMask containing only values true in the bitmask
123123 pub fn and_bitmask ( self , bitmask : Array ) -> VortexResult < Self > {
124- // TODO(robert): Avoid densifying sparse values just to get true indices
125- let sparse_mask =
126- SparseArray :: try_new ( self . to_indices_array ( ) ?, bitmask, self . len ( ) , false . into ( ) ) ?
127- . into_array ( )
128- . into_bool ( ) ?;
129- Self :: from_mask_array ( sparse_mask. as_ref ( ) , self . begin ( ) , self . end ( ) )
124+ // If we are a dense all true bitmap just take the bitmask array
125+ if self . len ( ) as u64 == self . values . cardinality ( ) {
126+ if bitmask. len ( ) != self . len ( ) {
127+ vortex_bail ! (
128+ "Bitmask length {} does not match our length {}" ,
129+ bitmask. len( ) ,
130+ self . values. cardinality( )
131+ ) ;
132+ }
133+ Self :: from_mask_array ( & bitmask, self . begin , self . end )
134+ } else {
135+ // TODO(robert): Avoid densifying sparse values just to get true indices
136+ let sparse_mask =
137+ SparseArray :: try_new ( self . to_indices_array ( ) ?, bitmask, self . len ( ) , false . into ( ) ) ?
138+ . into_array ( )
139+ . into_bool ( ) ?;
140+ Self :: from_mask_array ( sparse_mask. as_ref ( ) , self . begin ( ) , self . end ( ) )
141+ }
130142 }
131143
132144 pub fn is_empty ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments