Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton committed Dec 17, 2024
1 parent bb9fa22 commit 05cf968
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions arrow-select/src/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,12 +991,6 @@ mod tests {
assert_eq!(a, b);
});

let dict = list
.values()
.as_dictionary::<Int32Type>()
.downcast_dict::<StringArray>()
.unwrap();

assert_dictionary_has_unique_values::<_, StringArray>(
list.values().as_dictionary::<Int32Type>(),
);
Expand All @@ -1006,7 +1000,6 @@ mod tests {
fn concat_many_dictionary_list_arrays() {
let number_of_unique_values = 8;
let scalars = (0..80000)
.into_iter()
.map(|i| {
create_single_row_list_of_dict(vec![Some(
(i % number_of_unique_values).to_string(),
Expand All @@ -1022,7 +1015,6 @@ mod tests {

let expected_list = create_list_of_dict(
(0..80000)
.into_iter()
.map(|i| Some(vec![Some((i % number_of_unique_values).to_string())]))
.collect::<Vec<_>>(),
);
Expand All @@ -1034,12 +1026,6 @@ mod tests {
assert_eq!(a, b);
});

let dict = list
.values()
.as_dictionary::<Int32Type>()
.downcast_dict::<StringArray>()
.unwrap();

assert_dictionary_has_unique_values::<_, StringArray>(
list.values().as_dictionary::<Int32Type>(),
);
Expand Down Expand Up @@ -1132,7 +1118,7 @@ mod tests {
fn create_single_row_list_of_dict(
list_items: Vec<Option<impl AsRef<str>>>,
) -> GenericListArray<i32> {
let rows = list_items.into_iter().map(|row| Some(row)).collect();
let rows = list_items.into_iter().map(Some).collect();

create_list_of_dict(vec![rows])
}
Expand All @@ -1150,17 +1136,17 @@ mod tests {
builder.finish()
}

fn assert_dictionary_has_unique_values<'a, K, V: 'static>(array: &'a DictionaryArray<K>)
fn assert_dictionary_has_unique_values<'a, K, V>(array: &'a DictionaryArray<K>)
where
K: ArrowDictionaryKeyType,
V: Sync + Send,
V: Sync + Send + 'static,
&'a V: ArrayAccessor + IntoIterator,

<&'a V as ArrayAccessor>::Item: Default + Clone + PartialEq + Debug + Ord,
<&'a V as IntoIterator>::Item: Clone + PartialEq + Debug + Ord,
{
let dict = array.downcast_dict::<V>().unwrap();
let mut values = dict.values().clone().into_iter().collect::<Vec<_>>();
let mut values = dict.values().into_iter().collect::<Vec<_>>();

// remove duplicates must be sorted first so we can compare
values.sort();
Expand Down

0 comments on commit 05cf968

Please sign in to comment.