From 9a3e0d24a3ddca99288050797c43be8c84d40e0f Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Tue, 8 Sep 2020 18:51:16 +0100 Subject: [PATCH] refactor: cruft --- delorean_mem_qe/src/column.rs | 73 +-------------------------------- delorean_mem_qe/src/encoding.rs | 9 ---- delorean_mem_qe/src/segment.rs | 12 +++--- 3 files changed, 6 insertions(+), 88 deletions(-) diff --git a/delorean_mem_qe/src/column.rs b/delorean_mem_qe/src/column.rs index 7d7618d92b..45070387c7 100644 --- a/delorean_mem_qe/src/column.rs +++ b/delorean_mem_qe/src/column.rs @@ -595,65 +595,7 @@ impl Column { Column::Integer(c) => Vector::Integer(c.values(&row_ids_vec)), } } - - // /// materialise all rows including and after row_id - // pub fn scan_from(&self, _row_id: usize) -> Option { - // unimplemented!("todo"); - // // if row_id >= self.num_rows() { - // // println!( - // // "asking for {:?} but only got {:?} rows", - // // row_id, - // // self.num_rows() - // // ); - // // return None; - // // } - - // // println!( - // // "asking for {:?} with a column having {:?} rows", - // // row_id, - // // self.num_rows() - // // ); - // // match self { - // // Column::String(c) => Some(Vector::String(c.scan_from(row_id))), - // // Column::Float(c) => Some(Vector::Float(c.scan_from(row_id))), - // // Column::Integer(c) => Some(Vector::Integer(c.scan_from(row_id))), - // // } - // } - - /// Given the provided row_id scans the column until a non-null value found - /// or the column is exhausted. - pub fn scan_from_until_some(&self, row_id: usize) -> Option> { - match self { - Column::String(c) => { - if row_id >= self.num_rows() { - return None; - } - - match c.scan_from_until_some(row_id) { - Some(v) => Some(Scalar::String(v)), - None => None, - } - } - Column::Float(c) => { - if row_id >= self.num_rows() { - return None; - } - match c.scan_from_until_some(row_id) { - Some(v) => Some(Scalar::Float(v)), - None => None, - } - } - Column::Integer(c) => { - if row_id >= self.num_rows() { - return None; - } - match c.scan_from_until_some(row_id) { - Some(v) => Some(Scalar::Integer(v)), - None => None, - } - } - } - } +} pub fn maybe_contains(&self, value: Option<&Scalar<'_>>) -> bool { match self { @@ -1017,11 +959,6 @@ impl String { self.data.scan_from(row_id) } - pub fn scan_from_until_some(&self, _row_id: usize) -> Option<&std::string::String> { - unreachable!("don't need this"); - // self.data.scan_from_until_some(row_id) - } - // TODO(edd) shouldn't let roaring stuff leak out... pub fn group_row_ids(&self) -> &std::collections::BTreeMap { self.data.group_row_ids() @@ -1065,10 +1002,6 @@ impl Float { self.data.scan_from(row_id) } - pub fn scan_from_until_some(&self, row_id: usize) -> Option { - self.data.scan_from_until_some(row_id) - } - pub fn sum_by_ids(&self, row_ids: &mut croaring::Bitmap) -> f64 { self.data.sum_by_ids(row_ids) } @@ -1138,10 +1071,6 @@ impl Integer { self.data.scan_from(row_id) } - pub fn scan_from_until_some(&self, row_id: usize) -> Option { - self.data.scan_from_until_some(row_id) - } - /// Find the first logical row that contains this value. pub fn row_id_eq_value(&self, v: i64) -> Option { if !self.meta.maybe_contains_value(v) { diff --git a/delorean_mem_qe/src/encoding.rs b/delorean_mem_qe/src/encoding.rs index 32af51f4a7..1bed37f027 100644 --- a/delorean_mem_qe/src/encoding.rs +++ b/delorean_mem_qe/src/encoding.rs @@ -75,15 +75,6 @@ where self.values.clone() } - // TODO(edd): fix this when added NULL support - pub fn scan_from_until_some(&self, _row_id: usize) -> Option { - unreachable!("to remove"); - // for v in self.values.iter().skip(row_id) { - // return Some(*v); - // } - // None - } - pub fn scan_from(&self, row_id: usize) -> &[T] { &self.values[row_id..] } diff --git a/delorean_mem_qe/src/segment.rs b/delorean_mem_qe/src/segment.rs index 26e69a181b..47e673b28f 100644 --- a/delorean_mem_qe/src/segment.rs +++ b/delorean_mem_qe/src/segment.rs @@ -944,24 +944,22 @@ pub struct SegmentMetaData { column_names: Vec, time_range: (i64, i64), - // row_ids is a bitmap containing all row ids. - row_ids: croaring::Bitmap, + // row_ids: croaring::Bitmap, // TODO column sort order } impl SegmentMetaData { pub fn new(rows: usize, schema: Schema) -> Self { - let mut meta = Self { + Self { size: 0, rows, schema, column_names: vec![], time_range: (0, 0), - row_ids: croaring::Bitmap::create_with_capacity(rows as u32), - }; - meta.row_ids.add_range(0..rows as u64); - meta + // row_ids: croaring::Bitmap::create_with_capacity(rows as u32), + } + // meta.row_ids.add_range(0..rows as u64); } pub fn schema(&self) -> SchemaRef {