Skip to content

Commit

Permalink
add cory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Oct 30, 2024
1 parent 296d391 commit f2d9ad4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/daft-sql/src/modules/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ impl SQLFunction for SQLMinhash {
match inputs {
[input, args @ ..] => {
let input = planner.plan_function_arg(input)?;
let args: MinHashFunction =
planner.plan_function_args(args, &["num_hashes", "ngram_size", "seed"], 0)?;
let args: MinHashFunction = planner.plan_function_args(
args,
&["num_hashes", "ngram_size", "seed", "hash_function"],
0,
)?;

Ok(minhash(
input,
Expand Down
2 changes: 2 additions & 0 deletions tests/sql/test_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_hash_exprs():
hash(a, seed:=0) as hash_a_seed_0,
minhash(a, num_hashes:=10, ngram_size:= 100, seed:=10) as minhash_a,
minhash(a, num_hashes:=10, ngram_size:= 100) as minhash_a_no_seed,
minhash(a, num_hashes:=10, ngram_size:= 100, seed:=10, hash_function:='xxhash') as minhash_a_xxhash,
FROM df
""")
.collect()
Expand All @@ -58,6 +59,7 @@ def test_hash_exprs():
col("a").hash(seed=0).alias("hash_a_seed_0"),
col("a").minhash(num_hashes=10, ngram_size=100, seed=10).alias("minhash_a"),
col("a").minhash(num_hashes=10, ngram_size=100).alias("minhash_a_no_seed"),
col("a").minhash(num_hashes=10, ngram_size=100, seed=10, hash_function="xxhash").alias("minhash_a_xxhash"),
)
.collect()
.to_pydict()
Expand Down

0 comments on commit f2d9ad4

Please sign in to comment.