1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::chunked_array::object::extension::PolarsExtension;
use crate::prelude::*;
pub(crate) unsafe fn drop_list(ca: &mut ListChunked) {
let mut inner = ca.inner_dtype();
let mut nested_count = 0;
while let Some(a) = inner.inner_dtype() {
nested_count += 1;
inner = a.clone()
}
if matches!(inner, DataType::Object(_)) {
if nested_count != 0 {
panic!("multiple nested objects not yet supported")
}
assert!(!ca.chunks.is_empty());
for lst_arr in &ca.chunks {
if let ArrowDataType::LargeList(fld) = lst_arr.data_type() {
let dtype = fld.data_type();
assert!(matches!(dtype, ArrowDataType::Extension(_, _, _)));
let arr = lst_arr.as_any().downcast_ref::<LargeListArray>().unwrap();
let values = arr.values();
let arr = values
.as_any()
.downcast_ref::<FixedSizeBinaryArray>()
.unwrap();
let buf = arr.values();
if buf.shared_count_strong() == 1 {
PolarsExtension::new(arr.clone());
};
}
}
}
}