From ab458b5f17362dceda7f09e6c7b85489e07561d9 Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Fri, 6 Nov 2020 17:28:27 +0000 Subject: [PATCH] refactor: address PR feedback --- Cargo.lock | 1 + delorean_segment_store/Cargo.toml | 1 + delorean_segment_store/src/column.rs | 6 +++--- delorean_segment_store/src/segment.rs | 7 +++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8038d6dc5..5e51a8b21f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -731,6 +731,7 @@ dependencies = [ "arrow_deps", "criterion", "croaring", + "data_types", "packers", "rand", ] diff --git a/delorean_segment_store/Cargo.toml b/delorean_segment_store/Cargo.toml index 98c114e3a8..67db5856af 100644 --- a/delorean_segment_store/Cargo.toml +++ b/delorean_segment_store/Cargo.toml @@ -9,6 +9,7 @@ edition = "2018" [dependencies] arrow_deps = { path = "../arrow_deps" } +data_types = { path = "../data_types" } packers = { path = "../packers" } croaring = "0.4.5" diff --git a/delorean_segment_store/src/column.rs b/delorean_segment_store/src/column.rs index c85a070fd7..6494c42696 100644 --- a/delorean_segment_store/src/column.rs +++ b/delorean_segment_store/src/column.rs @@ -3063,9 +3063,9 @@ mod test { ); match row_ids { RowIDsOption::None(_) => panic!("expected some rows"), - RowIDsOption::Some(_dst) => { - assert_eq!(_dst.to_vec(), vec![0]); - dst_buffer = _dst; + RowIDsOption::Some(dst) => { + assert_eq!(dst.to_vec(), vec![0]); + dst_buffer = dst; } RowIDsOption::All(_) => panic!("expected some rows"), } diff --git a/delorean_segment_store/src/segment.rs b/delorean_segment_store/src/segment.rs index 1f5f1cd875..25754b5268 100644 --- a/delorean_segment_store/src/segment.rs +++ b/delorean_segment_store/src/segment.rs @@ -5,7 +5,8 @@ use arrow_deps::arrow::datatypes::SchemaRef; use crate::column::{cmp::Operator, Column, RowIDs, RowIDsOption, Scalar, Value, Values}; /// The name used for a timestamp column. -pub const TIME_COLUMN_NAME: &str = "time"; +pub const TIME_COLUMN_NAME: &str = data_types::TIME_COLUMN_NAME; + #[derive(Debug)] pub struct Schema { schema_ref: SchemaRef, @@ -255,7 +256,9 @@ impl<'a> Segment<'a> { let col = self.all_columns.get(*col_name).unwrap(); // Explanation of how this buffer pattern works here. The idea is - // that the + // that the buffer should be returned to the caller so it can be + // re-used on other columns. To do that we need to hand the buffer + // back even if we haven't populated it with any results. match col.row_ids_filter(op, value, dst) { // No rows will be returned for the segment because this column // doe not match any rows.