Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17d5dc9

Browse files
committed
Add test for alp-const-null compare
1 parent 9b1cfe0 commit 17d5dc9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

encodings/alp/src/compute.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ where
151151
mod tests {
152152
use vortex::array::PrimitiveArray;
153153
use vortex::IntoArrayVariant;
154+
use vortex_dtype::{DType, Nullability, PType};
154155

155156
use super::*;
156157
use crate::alp_encode;
@@ -199,4 +200,26 @@ mod tests {
199200
let buffer = r.boolean_buffer();
200201
assert!(buffer.value(buffer.len() - 1));
201202
}
203+
204+
#[test]
205+
fn compare_to_null() {
206+
let array = PrimitiveArray::from(vec![1.234f32; 1025]);
207+
let encoded = alp_encode(&array).unwrap();
208+
209+
let other = ConstantArray::new(
210+
Scalar::null(DType::Primitive(PType::F32, Nullability::Nullable)),
211+
array.len(),
212+
);
213+
214+
let r = encoded
215+
.maybe_compare(other.array(), Operator::Eq)
216+
.unwrap()
217+
.unwrap()
218+
.into_bool()
219+
.unwrap();
220+
221+
for v in r.boolean_buffer().iter() {
222+
assert!(!v);
223+
}
224+
}
202225
}

0 commit comments

Comments
 (0)