Skip to content

Commit c23bbed

Browse files
authored
Empty column tracker and new dataframe APIs on top (#7677)
Before: ![image](https://github.com/user-attachments/assets/1acdb4e6-1b48-4932-89a6-cd00814726eb) After: ![image](https://github.com/user-attachments/assets/d6b13b60-9d61-4aab-b577-381d22791e26) Of course with static data this still looks pretty weird in many cases, such as shown in this screenshot, But that's a job for the upcoming #7668. --- * Fixes #7615
1 parent c06745f commit c23bbed

File tree

10 files changed

+284
-155
lines changed

10 files changed

+284
-155
lines changed

crates/store/re_chunk/src/util.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ use itertools::Itertools;
1212

1313
// ---
1414

15+
/// Returns true if the given `list_array` is semantically empty.
16+
///
17+
/// Semantic emptiness is defined as either one of these:
18+
/// * The list is physically empty (literally no data).
19+
/// * The list only contains null entries, or empty arrays, or a mix of both.
20+
pub fn is_list_array_semantically_empty(list_array: &ArrowListArray<i32>) -> bool {
21+
let is_physically_empty = || list_array.is_empty();
22+
23+
let is_all_nulls = || {
24+
list_array
25+
.validity()
26+
.map_or(false, |bitmap| bitmap.unset_bits() == list_array.len())
27+
};
28+
29+
let is_all_empties = || list_array.offsets().lengths().all(|len| len == 0);
30+
31+
let is_a_mix_of_nulls_and_empties =
32+
|| list_array.iter().flatten().all(|array| array.is_empty());
33+
34+
is_physically_empty() || is_all_nulls() || is_all_empties() || is_a_mix_of_nulls_and_empties()
35+
}
36+
1537
/// Create a sparse list-array out of an array of arrays.
1638
///
1739
/// All arrays must have the same datatype.

0 commit comments

Comments
 (0)