From 6f8c5d6a343c3630da260a47ed500f66299392c4 Mon Sep 17 00:00:00 2001 From: Jefffrey Date: Sat, 28 Sep 2024 20:42:42 +1000 Subject: [PATCH] Remove default implemention of PrimitiveValueDecoder::decode --- src/encoding/mod.rs | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/encoding/mod.rs b/src/encoding/mod.rs index 7d088cc..f42e76c 100644 --- a/src/encoding/mod.rs +++ b/src/encoding/mod.rs @@ -30,7 +30,7 @@ use snafu::ResultExt; use crate::{ column::Column, - error::{InvalidColumnEncodingSnafu, IoSnafu, OutOfSpecSnafu, Result}, + error::{InvalidColumnEncodingSnafu, IoSnafu, Result}, memory::EstimateMemory, proto::column_encoding::Kind as ProtoColumnKind, }; @@ -78,31 +78,7 @@ where pub trait PrimitiveValueDecoder: Iterator> { /// Decode out.len() values into out at a time, failing if it cannot fill /// the buffer. - /// - /// By default it relies on Iterator::next(), but hopefully this can be - /// refactored away when it is properly implemented for all the decoders. - fn decode(&mut self, out: &mut [V]) -> Result<()> { - // TODO: eventually remove this as each decoder implements for themselves - let mut len = 0; - for n in out.iter_mut() { - match self.next() { - Some(r) => { - *n = r?; - len += 1; - } - None => break, - }; - } - if len != out.len() { - // TODO: more descriptive error - OutOfSpecSnafu { - msg: "Array length less than expected", - } - .fail() - } else { - Ok(()) - } - } + fn decode(&mut self, out: &mut [V]) -> Result<()>; /// Decode into `out` according to the `true` elements in `present`. ///