Skip to content

Commit c055526

Browse files
committed
simplify
1 parent a1c3f33 commit c055526

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/common.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,15 @@ fn remap_dictionary_key_nulls(
261261
) -> DataFusionResult<DictionaryArray<Int64Type>> {
262262
let mut new_keys_builder = PrimitiveBuilder::<Int64Type>::new();
263263
let mut value_indices_builder = PrimitiveBuilder::<Int64Type>::new();
264-
let mut value_map = HashMap::new(); // Map old indices to new indices
265-
let mut next_index = 0i64;
264+
let mut value_map: HashMap<i64, i64> = HashMap::new(); // Map old indices to new indices
266265

267266
// First pass: build mapping of old indices to new indices
268267
for key in keys.iter() {
269268
if let Some(k) = key {
270269
let k_usize = k.as_usize();
271270
if !values.is_null(k_usize) && !value_map.contains_key(&k) {
272-
value_map.insert(k, next_index);
271+
value_map.insert(k, i64::try_from(value_map.len()).expect("value_map overflow"));
273272
value_indices_builder.append_value(k);
274-
next_index += 1;
275273
}
276274
}
277275
}

0 commit comments

Comments
 (0)