refactor: cruft

pull/24376/head
Edd Robinson 2020-09-08 18:51:16 +01:00
parent 3dd41cb71d
commit 9a3e0d24a3
3 changed files with 6 additions and 88 deletions

View File

@ -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<Vector> {
// 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<Scalar<'_>> {
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<u32, croaring::Bitmap> {
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<f64> {
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<i64> {
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<usize> {
if !self.meta.maybe_contains_value(v) {

View File

@ -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<T> {
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..]
}

View File

@ -944,24 +944,22 @@ pub struct SegmentMetaData {
column_names: Vec<String>,
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 {