Skip to content

Commit 2c52d5a

Browse files
committed
update for bloom filter v2
1 parent 7e9e4b8 commit 2c52d5a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

native/spark-expr/src/bloom_filter/spark_bloom_filter.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::bloom_filter::spark_bit_array::SparkBitArray;
2424
use crate::hash_funcs::murmur3::spark_compatible_murmur3_hash;
2525

2626
const SPARK_BLOOM_FILTER_VERSION_1: i32 = 1;
27+
const SPARK_BLOOM_FILTER_VERSION_2: i32 = 2;
2728

2829
/// A Bloom filter implementation that simulates the behavior of Spark's BloomFilter.
2930
/// It's not a complete implementation of Spark's BloomFilter, but just add the minimum
@@ -60,9 +61,9 @@ impl From<&[u8]> for SparkBloomFilter {
6061
let mut offset = 0;
6162
let version = read_num_be_bytes!(i32, 4, buf[offset..]);
6263
offset += 4;
63-
assert_eq!(
64-
version, SPARK_BLOOM_FILTER_VERSION_1,
65-
"Unsupported BloomFilter version: {version}, expecting version: {SPARK_BLOOM_FILTER_VERSION_1}"
64+
assert!(
65+
version == SPARK_BLOOM_FILTER_VERSION_1 || version == SPARK_BLOOM_FILTER_VERSION_2,
66+
"Unsupported BloomFilter version: {version}, expecting version: {SPARK_BLOOM_FILTER_VERSION_1} or {SPARK_BLOOM_FILTER_VERSION_2}"
6667
);
6768
let num_hash_functions = read_num_be_bytes!(i32, 4, buf[offset..]);
6869
offset += 4;

0 commit comments

Comments
 (0)