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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use crate::prelude::*;
use crate::series::IsSorted;
pub(crate) fn new_chunks(chunks: &mut Vec<ArrayRef>, other: &[ArrayRef], len: usize) {
if chunks.len() == 1 && len == 0 {
*chunks = other.to_owned();
} else {
chunks.extend_from_slice(other);
}
}
impl<T> ChunkedArray<T>
where
T: PolarsNumericType,
{
pub fn append(&mut self, other: &Self) {
let len = self.len();
self.length += other.length;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted2(IsSorted::Not);
}
}
#[doc(hidden)]
impl BooleanChunked {
pub fn append(&mut self, other: &Self) {
let len = self.len();
self.length += other.length;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted2(IsSorted::Not);
}
}
#[doc(hidden)]
impl Utf8Chunked {
pub fn append(&mut self, other: &Self) {
let len = self.len();
self.length += other.length;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted2(IsSorted::Not);
}
}
#[cfg(feature = "dtype-binary")]
#[doc(hidden)]
impl BinaryChunked {
pub fn append(&mut self, other: &Self) {
let len = self.len();
self.length += other.length;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted2(IsSorted::Not);
}
}
#[doc(hidden)]
impl ListChunked {
pub fn append(&mut self, other: &Self) -> PolarsResult<()> {
let dtype = merge_dtypes(self.dtype(), other.dtype())?;
self.field = Arc::new(Field::new(self.name(), dtype));
let len = self.len();
self.length += other.length;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted2(IsSorted::Not);
Ok(())
}
}
#[cfg(feature = "object")]
#[doc(hidden)]
impl<T: PolarsObject> ObjectChunked<T> {
pub fn append(&mut self, other: &Self) {
let len = self.len();
self.length += other.length;
self.set_sorted2(IsSorted::Not);
new_chunks(&mut self.chunks, &other.chunks, len);
}
}