diff --git a/polars_hash/src/expressions.rs b/polars_hash/src/expressions.rs index a633816..a0d19c6 100644 --- a/polars_hash/src/expressions.rs +++ b/polars_hash/src/expressions.rs @@ -1,7 +1,8 @@ -use crate::fasthash_hashers::*; use crate::geohashers::{geohash_decoder, geohash_encoder, geohash_neighbors}; use crate::h3::h3_encoder; +use crate::murmurhash_hashers::*; use crate::sha_hashers::*; +use crate::xxhash_hashers::*; use polars::{ chunked_array::ops::arity::{ try_binary_elementwise, try_ternary_elementwise, unary_elementwise, diff --git a/polars_hash/src/lib.rs b/polars_hash/src/lib.rs index 09e0e92..216e813 100644 --- a/polars_hash/src/lib.rs +++ b/polars_hash/src/lib.rs @@ -1,8 +1,9 @@ mod expressions; -mod fasthash_hashers; mod geohashers; mod h3; +mod murmurhash_hashers; mod sha_hashers; +mod xxhash_hashers; use pyo3::types::PyModule; use pyo3::{pymodule, Bound, PyResult, Python}; diff --git a/polars_hash/src/fasthash_hashers.rs b/polars_hash/src/murmurhash_hashers.rs similarity index 65% rename from polars_hash/src/fasthash_hashers.rs rename to polars_hash/src/murmurhash_hashers.rs index d6b3da7..cd14f72 100644 --- a/polars_hash/src/fasthash_hashers.rs +++ b/polars_hash/src/murmurhash_hashers.rs @@ -1,8 +1,5 @@ use mur3::murmurhash3_x64_128; use mur3::murmurhash3_x86_32; -use xxhash_rust::xxh32::xxh32; -use xxhash_rust::xxh64::xxh64; - pub fn murmurhash3_32(value: Option<&str>, seed: u32) -> Option { value.map(|v| murmurhash3_x86_32(v.as_bytes(), seed)) } @@ -18,11 +15,3 @@ pub fn murmurhash3_128(value: Option<&str>, seed: u32) -> Option> { result }) } - -pub fn xxhash_32(value: Option<&str>, seed: u32) -> Option { - value.map(|v| xxh32(v.as_bytes(), seed)) -} - -pub fn xxhash_64(value: Option<&str>, seed: u64) -> Option { - value.map(|v| xxh64(v.as_bytes(), seed)) -} diff --git a/polars_hash/src/xxhash_hashers.rs b/polars_hash/src/xxhash_hashers.rs new file mode 100644 index 0000000..be5d17b --- /dev/null +++ b/polars_hash/src/xxhash_hashers.rs @@ -0,0 +1,10 @@ +use xxhash_rust::xxh32::xxh32; +use xxhash_rust::xxh64::xxh64; + +pub fn xxhash_32(value: Option<&str>, seed: u32) -> Option { + value.map(|v| xxh32(v.as_bytes(), seed)) +} + +pub fn xxhash_64(value: Option<&str>, seed: u64) -> Option { + value.map(|v| xxh64(v.as_bytes(), seed)) +}