From 89d58538c704505b4eedc72ce779a93185ca4f5e Mon Sep 17 00:00:00 2001 From: Eugene Tolbakov Date: Tue, 16 Apr 2024 15:40:16 +0100 Subject: [PATCH] chore(mito): set null value data size to i64 (#3722) * chore(mito): set null value data size to i64 * chore(mito): move comment to a relevant place --- src/datatypes/src/value.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/datatypes/src/value.rs b/src/datatypes/src/value.rs index 64635eeae2..1483b82adc 100644 --- a/src/datatypes/src/value.rs +++ b/src/datatypes/src/value.rs @@ -1230,7 +1230,9 @@ impl<'a> ValueRef<'a> { /// The size is estimated and only considers the data size. pub fn data_size(&self) -> usize { match *self { - ValueRef::Null => 0, + // Since the `Null` type is also considered to occupy space, we have opted to use the + // size of `i64` as an initial approximation. + ValueRef::Null => 8, ValueRef::Boolean(_) => 1, ValueRef::UInt8(_) => 1, ValueRef::UInt16(_) => 2, @@ -2339,6 +2341,7 @@ mod tests { #[test] fn test_value_ref_estimated_size() { + check_value_ref_size_eq(&ValueRef::Null, 8); check_value_ref_size_eq(&ValueRef::Boolean(true), 1); check_value_ref_size_eq(&ValueRef::UInt8(1), 1); check_value_ref_size_eq(&ValueRef::UInt16(1), 2);