@@ -118,19 +118,17 @@ impl<O: GroupIndexOperations> NullState<O> {
118
118
mut value_fn : F ,
119
119
) where
120
120
T : ArrowPrimitiveType + Send ,
121
- F : FnMut ( u32 , u64 , T :: Native ) + Send ,
121
+ F : FnMut ( usize , usize , T :: Native ) + Send ,
122
122
{
123
123
// ensure the seen_values is big enough (start everything at
124
124
// "not seen" valid)
125
125
let seen_values =
126
126
initialize_builder ( & mut self . seen_values , total_num_groups, false ) ;
127
127
let block_size = self . block_size . unwrap_or_default ( ) ;
128
- accumulate ( group_indices, values, opt_filter, |packed_index, value| {
129
- let packed_index = packed_index as u64 ;
130
- let block_id = O :: get_block_id ( packed_index) ;
131
- let block_offset = O :: get_block_offset ( packed_index) ;
132
- let flat_index = O :: get_flat_index ( block_id, block_offset, block_size) ;
133
- seen_values. set_bit ( flat_index, false ) ;
128
+ accumulate ( group_indices, values, opt_filter, |group_index, value| {
129
+ let block_id = O :: get_block_id ( group_index, block_size) ;
130
+ let block_offset = O :: get_block_offset ( group_index, block_size) ;
131
+ seen_values. set_bit ( group_index, false ) ;
134
132
value_fn ( block_id, block_offset, value) ;
135
133
} ) ;
136
134
}
@@ -153,7 +151,7 @@ impl<O: GroupIndexOperations> NullState<O> {
153
151
total_num_groups : usize ,
154
152
mut value_fn : F ,
155
153
) where
156
- F : FnMut ( u32 , u64 , bool ) + Send ,
154
+ F : FnMut ( usize , usize , bool ) + Send ,
157
155
{
158
156
let data = values. values ( ) ;
159
157
assert_eq ! ( data. len( ) , group_indices. len( ) ) ;
@@ -170,13 +168,10 @@ impl<O: GroupIndexOperations> NullState<O> {
170
168
// if we have previously seen nulls, ensure the null
171
169
// buffer is big enough (start everything at valid)
172
170
group_indices. iter ( ) . zip ( data. iter ( ) ) . for_each (
173
- |( & packed_index, new_value) | {
174
- let packed_index = packed_index as u64 ;
175
- let block_id = O :: get_block_id ( packed_index) ;
176
- let block_offset = O :: get_block_offset ( packed_index) ;
177
- let flat_index =
178
- O :: get_flat_index ( block_id, block_offset, block_size) ;
179
- seen_values. set_bit ( flat_index, true ) ;
171
+ |( & group_index, new_value) | {
172
+ let block_id = O :: get_block_id ( group_index, block_size) ;
173
+ let block_offset = O :: get_block_offset ( group_index, block_size) ;
174
+ seen_values. set_bit ( group_index, false ) ;
180
175
value_fn ( block_id, block_offset, new_value)
181
176
} ,
182
177
)
@@ -188,14 +183,11 @@ impl<O: GroupIndexOperations> NullState<O> {
188
183
. iter ( )
189
184
. zip ( data. iter ( ) )
190
185
. zip ( nulls. iter ( ) )
191
- . for_each ( |( ( & packed_index , new_value) , is_valid) | {
186
+ . for_each ( |( ( & group_index , new_value) , is_valid) | {
192
187
if is_valid {
193
- let packed_index = packed_index as u64 ;
194
- let block_id = O :: get_block_id ( packed_index) ;
195
- let block_offset = O :: get_block_offset ( packed_index) ;
196
- let flat_index =
197
- O :: get_flat_index ( block_id, block_offset, block_size) ;
198
- seen_values. set_bit ( flat_index, true ) ;
188
+ let block_id = O :: get_block_id ( group_index, block_size) ;
189
+ let block_offset = O :: get_block_offset ( group_index, block_size) ;
190
+ seen_values. set_bit ( group_index, false ) ;
199
191
value_fn ( block_id, block_offset, new_value) ;
200
192
}
201
193
} )
@@ -208,14 +200,11 @@ impl<O: GroupIndexOperations> NullState<O> {
208
200
. iter ( )
209
201
. zip ( data. iter ( ) )
210
202
. zip ( filter. iter ( ) )
211
- . for_each ( |( ( & packed_index , new_value) , filter_value) | {
203
+ . for_each ( |( ( & group_index , new_value) , filter_value) | {
212
204
if let Some ( true ) = filter_value {
213
- let packed_index = packed_index as u64 ;
214
- let block_id = O :: get_block_id ( packed_index) ;
215
- let block_offset = O :: get_block_offset ( packed_index) ;
216
- let flat_index =
217
- O :: get_flat_index ( block_id, block_offset, block_size) ;
218
- seen_values. set_bit ( flat_index, true ) ;
205
+ let block_id = O :: get_block_id ( group_index, block_size) ;
206
+ let block_offset = O :: get_block_offset ( group_index, block_size) ;
207
+ seen_values. set_bit ( group_index, false ) ;
219
208
value_fn ( block_id, block_offset, new_value) ;
220
209
}
221
210
} )
@@ -227,15 +216,12 @@ impl<O: GroupIndexOperations> NullState<O> {
227
216
. iter ( )
228
217
. zip ( group_indices. iter ( ) )
229
218
. zip ( values. iter ( ) )
230
- . for_each ( |( ( filter_value, & packed_index ) , new_value) | {
219
+ . for_each ( |( ( filter_value, & group_index ) , new_value) | {
231
220
if let Some ( true ) = filter_value {
232
221
if let Some ( new_value) = new_value {
233
- let packed_index = packed_index as u64 ;
234
- let block_id = O :: get_block_id ( packed_index) ;
235
- let block_offset = O :: get_block_offset ( packed_index) ;
236
- let flat_index =
237
- O :: get_flat_index ( block_id, block_offset, block_size) ;
238
- seen_values. set_bit ( flat_index, true ) ;
222
+ let block_id = O :: get_block_id ( group_index, block_size) ;
223
+ let block_offset = O :: get_block_offset ( group_index, block_size) ;
224
+ seen_values. set_bit ( group_index, false ) ;
239
225
value_fn ( block_id, block_offset, new_value) ;
240
226
}
241
227
}
@@ -287,7 +273,7 @@ impl NullStateAdapter {
287
273
value_fn : F ,
288
274
) where
289
275
T : ArrowPrimitiveType + Send ,
290
- F : FnMut ( u32 , u64 , T :: Native ) + Send ,
276
+ F : FnMut ( usize , usize , T :: Native ) + Send ,
291
277
{
292
278
match self {
293
279
NullStateAdapter :: Flat ( null_state) => null_state. accumulate (
@@ -315,7 +301,7 @@ impl NullStateAdapter {
315
301
total_num_groups : usize ,
316
302
value_fn : F ,
317
303
) where
318
- F : FnMut ( u32 , u64 , bool ) + Send ,
304
+ F : FnMut ( usize , usize , bool ) + Send ,
319
305
{
320
306
match self {
321
307
NullStateAdapter :: Flat ( null_state) => null_state. accumulate_boolean (
@@ -434,9 +420,7 @@ impl Default for FlatNullState {
434
420
impl FlatNullState {
435
421
pub fn build ( & mut self , emit_to : EmitTo ) -> NullBuffer {
436
422
match emit_to {
437
- EmitTo :: All => {
438
- NullBuffer :: new ( self . seen_values . finish ( ) )
439
- }
423
+ EmitTo :: All => NullBuffer :: new ( self . seen_values . finish ( ) ) ,
440
424
EmitTo :: First ( n) => {
441
425
// split off the first N values in seen_values
442
426
//
0 commit comments