From 27410ce0dec6bce71b839caba9c7da21dbe28699 Mon Sep 17 00:00:00 2001 From: xuming10797 Date: Tue, 25 Mar 2025 17:14:40 +0800 Subject: [PATCH] keep same algorithm between put_long/put_binary and might_contain_long/might_contain_binary --- .../datafusion-ext-commons/src/spark_bloom_filter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native-engine/datafusion-ext-commons/src/spark_bloom_filter.rs b/native-engine/datafusion-ext-commons/src/spark_bloom_filter.rs index e8ec0e86b..17e471470 100644 --- a/native-engine/datafusion-ext-commons/src/spark_bloom_filter.rs +++ b/native-engine/datafusion-ext-commons/src/spark_bloom_filter.rs @@ -92,7 +92,7 @@ impl SparkBloomFilter { let mut combined_hash = h1 + i * h2; // flip all the bits if it's negative (guaranteed positive number) combined_hash = combined_hash ^ -((combined_hash < 0) as i32); - self.bits.set((combined_hash & (bit_size - 1)) as usize); + self.bits.set((combined_hash % bit_size) as usize); } } @@ -107,7 +107,7 @@ impl SparkBloomFilter { let mut combined_hash = h1 + i * h2; // flip all the bits if it's negative (guaranteed positive number) combined_hash = combined_hash ^ -((combined_hash < 0) as i32); - self.bits.set((combined_hash & (bit_size - 1)) as usize); + self.bits.set((combined_hash % bit_size) as usize); } }