feat: implement size on fixed_null encoding
@@ -66,11 +66,10 @@ where
self.arr.null_count() > 0
}
- /// Returns the total size in bytes of the encoded data. Note, this method
- /// is really an "accurate" estimation. It doesn't include for example the
- /// size of the `Plain` struct receiver.
+ /// Returns an estimation of the total size in bytes used by this column
+ /// encoding.
pub fn size(&self) -> u64 {
- 0
+ (std::mem::size_of::<PrimitiveArray<T>>() + self.arr.get_array_memory_size()) as u64
}
//
@@ -598,6 +597,12 @@ mod test {
v.iter().map(|x| Some(*x)).collect()
}
+ #[test]
+ fn size() {
+ let v = FixedNull::<UInt64Type>::from(vec![None, None, Some(100), Some(2222)].as_slice());
+ assert_eq!(v.size(), 240);
+ }
+
#[test]
fn first_row_id_eq_value() {
let v = super::FixedNull::<Int64Type>::from(vec![22, 33, 18].as_slice());
