polars_core/series/implementations/
binary_offset.rs1use super::*;
2#[cfg(feature = "algorithm_group_by")]
3use crate::frame::group_by::*;
4use crate::prelude::*;
5use crate::series::private::PrivateSeries;
6
7impl private::PrivateSeries for SeriesWrap<BinaryOffsetChunked> {
8 fn compute_len(&mut self) {
9 self.0.compute_len()
10 }
11 fn _field(&self) -> Cow<'_, Field> {
12 Cow::Borrowed(self.0.ref_field())
13 }
14 fn _dtype(&self) -> &DataType {
15 self.0.ref_field().dtype()
16 }
17 fn _get_flags(&self) -> StatisticsFlags {
18 self.0.get_flags()
19 }
20 fn _set_flags(&mut self, flags: StatisticsFlags) {
21 self.0.set_flags(flags)
22 }
23
24 fn into_total_eq_inner<'a>(&'a self) -> Box<dyn TotalEqInner + 'a> {
25 (&self.0).into_total_eq_inner()
26 }
27 fn into_total_ord_inner<'a>(&'a self) -> Box<dyn TotalOrdInner + 'a> {
28 (&self.0).into_total_ord_inner()
29 }
30
31 fn vec_hash(
32 &self,
33 random_state: PlSeedableRandomStateQuality,
34 buf: &mut Vec<u64>,
35 ) -> PolarsResult<()> {
36 self.0.vec_hash(random_state, buf)?;
37 Ok(())
38 }
39
40 fn vec_hash_combine(
41 &self,
42 build_hasher: PlSeedableRandomStateQuality,
43 hashes: &mut [u64],
44 ) -> PolarsResult<()> {
45 self.0.vec_hash_combine(build_hasher, hashes)?;
46 Ok(())
47 }
48
49 #[cfg(feature = "algorithm_group_by")]
50 fn group_tuples(&self, multithreaded: bool, sorted: bool) -> PolarsResult<GroupsType> {
51 IntoGroupsType::group_tuples(&self.0, multithreaded, sorted)
52 }
53
54 fn arg_sort_multiple(
55 &self,
56 by: &[Column],
57 options: &SortMultipleOptions,
58 ) -> PolarsResult<IdxCa> {
59 self.0.arg_sort_multiple(by, options)
60 }
61}
62
63impl SeriesTrait for SeriesWrap<BinaryOffsetChunked> {
64 fn rename(&mut self, name: PlSmallStr) {
65 self.0.rename(name);
66 }
67
68 fn chunk_lengths(&self) -> ChunkLenIter<'_> {
69 self.0.chunk_lengths()
70 }
71 fn name(&self) -> &PlSmallStr {
72 self.0.name()
73 }
74
75 fn chunks(&self) -> &Vec<ArrayRef> {
76 self.0.chunks()
77 }
78 unsafe fn chunks_mut(&mut self) -> &mut Vec<ArrayRef> {
79 self.0.chunks_mut()
80 }
81 fn shrink_to_fit(&mut self) {
82 self.0.shrink_to_fit()
83 }
84
85 fn slice(&self, offset: i64, length: usize) -> Series {
86 self.0.slice(offset, length).into_series()
87 }
88 fn split_at(&self, offset: i64) -> (Series, Series) {
89 let (a, b) = self.0.split_at(offset);
90 (a.into_series(), b.into_series())
91 }
92
93 fn append(&mut self, other: &Series) -> PolarsResult<()> {
94 polars_ensure!(self.0.dtype() == other.dtype(), append);
95 self.0.append(other.as_ref().as_ref())?;
97 Ok(())
98 }
99 fn append_owned(&mut self, other: Series) -> PolarsResult<()> {
100 polars_ensure!(self.0.dtype() == other.dtype(), append);
101 self.0.append_owned(other.take_inner())
102 }
103
104 fn extend(&mut self, other: &Series) -> PolarsResult<()> {
105 polars_ensure!(self.0.dtype() == other.dtype(), extend);
106 self.0.extend(other.as_ref().as_ref())?;
107 Ok(())
108 }
109
110 fn filter(&self, filter: &BooleanChunked) -> PolarsResult<Series> {
111 ChunkFilter::filter(&self.0, filter).map(|ca| ca.into_series())
112 }
113
114 fn take(&self, indices: &IdxCa) -> PolarsResult<Series> {
115 Ok(self.0.take(indices)?.into_series())
116 }
117
118 unsafe fn take_unchecked(&self, indices: &IdxCa) -> Series {
119 self.0.take_unchecked(indices).into_series()
120 }
121
122 fn take_slice(&self, indices: &[IdxSize]) -> PolarsResult<Series> {
123 Ok(self.0.take(indices)?.into_series())
124 }
125
126 unsafe fn take_slice_unchecked(&self, indices: &[IdxSize]) -> Series {
127 self.0.take_unchecked(indices).into_series()
128 }
129
130 fn deposit(&self, validity: &Bitmap) -> Series {
131 self.0.deposit(validity).into_series()
132 }
133
134 fn len(&self) -> usize {
135 self.0.len()
136 }
137
138 #[cfg(feature = "algorithm_group_by")]
139 fn n_unique(&self) -> PolarsResult<usize> {
140 self.group_tuples(true, false).map(|g| g.len())
142 }
143
144 #[cfg(feature = "algorithm_group_by")]
145 fn unique_id(&self) -> PolarsResult<(IdxSize, Vec<IdxSize>)> {
146 ChunkUnique::unique_id(&self.0)
147 }
148
149 fn rechunk(&self) -> Series {
150 self.0.rechunk().into_owned().into_series()
151 }
152
153 fn with_validity(&self, validity: Option<Bitmap>) -> Series {
154 self.0.clone().with_validity(validity).into_series()
155 }
156
157 fn new_from_index(&self, index: usize, length: usize) -> Series {
158 ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series()
159 }
160
161 fn cast(&self, dtype: &DataType, options: CastOptions) -> PolarsResult<Series> {
162 self.0.cast_with_options(dtype, options)
163 }
164
165 #[inline]
166 unsafe fn get_unchecked(&self, index: usize) -> AnyValue<'_> {
167 self.0.get_any_value_unchecked(index)
168 }
169
170 fn sort_with(&self, options: SortOptions) -> PolarsResult<Series> {
171 Ok(ChunkSort::sort_with(&self.0, options).into_series())
172 }
173
174 fn arg_sort(&self, options: SortOptions) -> IdxCa {
175 ChunkSort::arg_sort(&self.0, options)
176 }
177
178 fn null_count(&self) -> usize {
179 self.0.null_count()
180 }
181
182 fn has_nulls(&self) -> bool {
183 self.0.has_nulls()
184 }
185
186 fn is_null(&self) -> BooleanChunked {
187 self.0.is_null()
188 }
189
190 fn is_not_null(&self) -> BooleanChunked {
191 self.0.is_not_null()
192 }
193
194 fn reverse(&self) -> Series {
195 ChunkReverse::reverse(&self.0).into_series()
196 }
197
198 fn shift(&self, periods: i64) -> Series {
199 ChunkShift::shift(&self.0, periods).into_series()
200 }
201
202 fn clone_inner(&self) -> Arc<dyn SeriesTrait> {
203 Arc::new(SeriesWrap(Clone::clone(&self.0)))
204 }
205
206 fn find_validity_mismatch(&self, other: &Series, idxs: &mut Vec<IdxSize>) {
207 self.0.find_validity_mismatch(other, idxs)
208 }
209
210 fn as_any(&self) -> &dyn Any {
211 &self.0
212 }
213
214 fn as_any_mut(&mut self) -> &mut dyn Any {
215 &mut self.0
216 }
217
218 fn as_phys_any(&self) -> &dyn Any {
219 &self.0
220 }
221
222 fn as_arc_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> {
223 self as _
224 }
225}