Skip to content

Commit

Permalink
restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzwilksch committed Nov 27, 2024
1 parent 921999a commit c62383d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion polars_hash/src/expressions.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion polars_hash/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
Original file line number Diff line number Diff line change
@@ -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<u32> {
value.map(|v| murmurhash3_x86_32(v.as_bytes(), seed))
}
Expand All @@ -18,11 +15,3 @@ pub fn murmurhash3_128(value: Option<&str>, seed: u32) -> Option<Vec<u8>> {
result
})
}

pub fn xxhash_32(value: Option<&str>, seed: u32) -> Option<u32> {
value.map(|v| xxh32(v.as_bytes(), seed))
}

pub fn xxhash_64(value: Option<&str>, seed: u64) -> Option<u64> {
value.map(|v| xxh64(v.as_bytes(), seed))
}
10 changes: 10 additions & 0 deletions polars_hash/src/xxhash_hashers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use xxhash_rust::xxh32::xxh32;
use xxhash_rust::xxh64::xxh64;

pub fn xxhash_32(value: Option<&str>, seed: u32) -> Option<u32> {
value.map(|v| xxh32(v.as_bytes(), seed))
}

pub fn xxhash_64(value: Option<&str>, seed: u64) -> Option<u64> {
value.map(|v| xxh64(v.as_bytes(), seed))
}

0 comments on commit c62383d

Please sign in to comment.