Skip to content

Commit

Permalink
feat(rust, python): streaming inner joins. (pola-rs#5400)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored and zundertj committed Jan 7, 2023
1 parent 0a9e171 commit dc63579
Show file tree
Hide file tree
Showing 35 changed files with 1,734 additions and 922 deletions.
1 change: 1 addition & 0 deletions polars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ algo = ["polars-algo"]
cse = ["polars-lazy/cse"]
propagate_nans = ["polars-lazy/propagate_nans"]
coalesce = ["polars-lazy/coalesce"]
streaming = ["polars-lazy/streaming"]

test = [
"lazy",
Expand Down
35 changes: 26 additions & 9 deletions polars/polars-core/src/datatypes/aliases.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
use super::*;

#[cfg(feature = "private")]
pub type PlHashMap<K, V> = hashbrown::HashMap<K, V, RandomState>;
#[cfg(feature = "private")]
pub type PlHashSet<V> = hashbrown::HashSet<V, RandomState>;
#[cfg(feature = "private")]
pub type PlIndexMap<K, V> = indexmap::IndexMap<K, V, RandomState>;
#[cfg(feature = "private")]
pub type PlIndexSet<K> = indexmap::IndexSet<K, RandomState>;

#[cfg(not(feature = "bigidx"))]
pub type IdxCa = UInt32Chunked;
#[cfg(feature = "bigidx")]
pub type IdxCa = UInt64Chunked;
pub use polars_arrow::index::{IdxArr, IdxSize};

use crate::vector_hasher::IdBuildHasher;

#[cfg(not(feature = "bigidx"))]
pub const IDX_DTYPE: DataType = DataType::UInt32;
#[cfg(feature = "bigidx")]
Expand All @@ -27,6 +20,19 @@ pub type IdxType = UInt64Type;

pub const NULL_DTYPE: DataType = DataType::Int32;

#[cfg(feature = "private")]
pub type PlHashMap<K, V> = hashbrown::HashMap<K, V, RandomState>;
#[cfg(feature = "private")]

/// This hashmap has the uses an IdHasher
pub type PlIdHashMap<K, V> = hashbrown::HashMap<K, V, IdBuildHasher>;
#[cfg(feature = "private")]
pub type PlHashSet<V> = hashbrown::HashSet<V, RandomState>;
#[cfg(feature = "private")]
pub type PlIndexMap<K, V> = indexmap::IndexMap<K, V, RandomState>;
#[cfg(feature = "private")]
pub type PlIndexSet<K> = indexmap::IndexSet<K, RandomState>;

pub trait InitHashMaps {
type HashMap;

Expand Down Expand Up @@ -81,3 +87,14 @@ impl<K, V> InitHashMaps for PlIndexMap<K, V> {
Self::with_capacity_and_hasher(capacity, Default::default())
}
}
impl<K, V> InitHashMaps for PlIdHashMap<K, V> {
type HashMap = Self;

fn new() -> Self::HashMap {
Self::with_capacity_and_hasher(0, Default::default())
}

fn with_capacity(capacity: usize) -> Self {
Self::with_capacity_and_hasher(capacity, Default::default())
}
}
Loading

0 comments on commit dc63579

Please sign in to comment.