polars_core/datatypes/
aliases.rs

1pub use arrow::legacy::index::IdxArr;
2pub use polars_utils::aliases::{
3    InitHashMaps, PlHashMap, PlHashSet, PlIndexMap, PlIndexSet, PlRandomState,
4};
5
6use super::*;
7use crate::hashing::IdBuildHasher;
8
9#[cfg(not(feature = "bigidx"))]
10pub type IdxCa = UInt32Chunked;
11#[cfg(feature = "bigidx")]
12pub type IdxCa = UInt64Chunked;
13
14pub const IDX_DTYPE: DataType = DataType::IDX_DTYPE;
15
16#[cfg(not(feature = "bigidx"))]
17pub type IdxType = UInt32Type;
18#[cfg(feature = "bigidx")]
19pub type IdxType = UInt64Type;
20
21pub use polars_utils::pl_str::PlSmallStr;
22
23/// This hashmap uses an IdHasher
24pub type PlIdHashMap<K, V> = hashbrown::HashMap<K, V, IdBuildHasher>;
25
26pub trait InitHashMaps2 {
27    type HashMap;
28
29    fn new() -> Self::HashMap;
30
31    fn with_capacity(capacity: usize) -> Self::HashMap;
32}
33
34impl<K, V> InitHashMaps2 for PlIdHashMap<K, V> {
35    type HashMap = Self;
36
37    fn new() -> Self::HashMap {
38        Self::with_capacity_and_hasher(0, Default::default())
39    }
40
41    fn with_capacity(capacity: usize) -> Self {
42        Self::with_capacity_and_hasher(capacity, Default::default())
43    }
44}