Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Feb 4, 2025
1 parent af6c807 commit 861f1df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn remap_dictionary_key_nulls(
values: ArrayRef,
) -> DataFusionResult<DictionaryArray<Int64Type>> {
// fast path: no nulls in values
if values.null_count() == 0{
if values.null_count() == 0 {
return Ok(DictionaryArray::new(keys, values));
}

Expand Down
22 changes: 6 additions & 16 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,11 +1280,13 @@ async fn test_dict_haystack() {
assert_batches_eq!(expected, &batches);
}


fn check_for_null_dictionary_values(array: &dyn Array) {
let array = array.as_any().downcast_ref::<DictionaryArray<Int64Type>>().unwrap();
let keys_array = array.keys();
let keys = keys_array.iter().filter_map(|x| x.map(|v| usize::try_from(v).unwrap())).collect::<Vec<_>>();
let keys = keys_array
.iter()
.filter_map(|x| x.map(|v| usize::try_from(v).unwrap()))
.collect::<Vec<_>>();
let values_array = array.values();
// no non-null keys should point to a null value
for i in 0..values_array.len() {
Expand Down Expand Up @@ -1330,20 +1332,8 @@ async fn test_dict_get_no_null_values() {

let sql = "select json_get_str(x, 'baz') v from data";
let expected = [
"+------+",
"| v |",
"+------+",
"| |",
"| fizz |",
"| |",
"| abcd |",
"| |",
"| fizz |",
"| fizz |",
"| fizz |",
"| fizz |",
"| |",
"+------+",
"+------+", "| v |", "+------+", "| |", "| fizz |", "| |", "| abcd |", "| |", "| fizz |",
"| fizz |", "| fizz |", "| fizz |", "| |", "+------+",
];
let batches = ctx.sql(&sql).await.unwrap().collect().await.unwrap();
assert_batches_eq!(expected, &batches);
Expand Down

0 comments on commit 861f1df

Please sign in to comment.