|
1 | 1 | use arrow::types::PrimitiveType; |
| 2 | +#[cfg(feature = "dtype-categorical")] |
| 3 | +use polars_utils::sync::SyncPtr; |
2 | 4 | use polars_utils::unwrap::UnwrapUncheckedRelease; |
3 | 5 |
|
4 | 6 | use super::*; |
@@ -56,7 +58,9 @@ pub enum AnyValue<'a> { |
56 | 58 | #[cfg(feature = "dtype-time")] |
57 | 59 | Time(i64), |
58 | 60 | #[cfg(feature = "dtype-categorical")] |
59 | | - Categorical(u32, &'a RevMapping), |
| 61 | + // If syncptr is_null the data is in the rev-map |
| 62 | + // otherwise it is in the array pointer |
| 63 | + Categorical(u32, &'a RevMapping, SyncPtr<Utf8Array<i64>>), |
60 | 64 | /// Nested type, contains arrays that are filled with one of the datetypes. |
61 | 65 | List(Series), |
62 | 66 | #[cfg(feature = "object")] |
@@ -357,7 +361,7 @@ impl<'a> AnyValue<'a> { |
357 | 361 | Boolean(_) => DataType::Boolean, |
358 | 362 | Utf8(_) => DataType::Utf8, |
359 | 363 | #[cfg(feature = "dtype-categorical")] |
360 | | - Categorical(_, _) => DataType::Categorical(None), |
| 364 | + Categorical(_, _, _) => DataType::Categorical(None), |
361 | 365 | List(s) => DataType::List(Box::new(s.dtype().clone())), |
362 | 366 | #[cfg(feature = "dtype-struct")] |
363 | 367 | Struct(_, _, fields) => DataType::Struct(fields.to_vec()), |
@@ -616,7 +620,7 @@ impl PartialEq for AnyValue<'_> { |
616 | 620 | // should it? |
617 | 621 | (Null, Null) => true, |
618 | 622 | #[cfg(feature = "dtype-categorical")] |
619 | | - (Categorical(idx_l, rev_l), Categorical(idx_r, rev_r)) => match (rev_l, rev_r) { |
| 623 | + (Categorical(idx_l, rev_l, _), Categorical(idx_r, rev_r, _)) => match (rev_l, rev_r) { |
620 | 624 | (RevMapping::Global(_, _, id_l), RevMapping::Global(_, _, id_r)) => { |
621 | 625 | id_l == id_r && idx_l == idx_r |
622 | 626 | } |
|
0 commit comments