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
This commit is contained in:
Eugene Tolbakov
2024-04-16 15:40:16 +01:00
committed by GitHub
parent d12379106e
commit 89d58538c7

View File

@@ -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);