diff --git a/read_buffer/src/chunk.rs b/read_buffer/src/chunk.rs index 1ca84a1789..01a8571d55 100644 --- a/read_buffer/src/chunk.rs +++ b/read_buffer/src/chunk.rs @@ -258,7 +258,7 @@ impl Chunk { } /// Returns the distinct set of column names that contain data matching the - /// provided optional predicate. + /// provided predicate, which may be empty. /// /// `dst` is a buffer that will be populated with results. `column_names` is /// smart enough to short-circuit processing on row groups when it diff --git a/read_buffer/src/column/bool.rs b/read_buffer/src/column/bool.rs index a71a16bb64..704e535d09 100644 --- a/read_buffer/src/column/bool.rs +++ b/read_buffer/src/column/bool.rs @@ -307,11 +307,7 @@ impl Bool { /// Returns true if the column contains any non-null values at the rows /// provided. pub fn has_non_null_value(&self, row_ids: &[u32]) -> bool { - if !self.contains_null() { - return true; - } - - row_ids.iter().any(|id| !self.arr.is_null(*id as usize)) + !self.contains_null() || row_ids.iter().any(|id| !self.arr.is_null(*id as usize)) } } diff --git a/read_buffer/src/column/dictionary/plain.rs b/read_buffer/src/column/dictionary/plain.rs index 84b66015bb..b589a98c10 100644 --- a/read_buffer/src/column/dictionary/plain.rs +++ b/read_buffer/src/column/dictionary/plain.rs @@ -670,7 +670,7 @@ impl Plain { return true; } - // If there are more than one dictionary entries then there is a non-null + // If there is more than one dictionary entry then there is a non-null // value in the column. self.entries.len() > 1 } diff --git a/read_buffer/src/column/dictionary/rle.rs b/read_buffer/src/column/dictionary/rle.rs index 879bbdae92..2fc29e37d1 100644 --- a/read_buffer/src/column/dictionary/rle.rs +++ b/read_buffer/src/column/dictionary/rle.rs @@ -801,7 +801,7 @@ impl RLE { return true; } - // If there are any non-null rows then there will entries in the + // If there are any non-null rows then there are entries in the // dictionary. !self.entry_index.is_empty() } diff --git a/read_buffer/src/lib.rs b/read_buffer/src/lib.rs index ba1a68f522..7e006e304b 100644 --- a/read_buffer/src/lib.rs +++ b/read_buffer/src/lib.rs @@ -488,7 +488,7 @@ impl Database { })?; let chunk_data = partition.data.read().unwrap(); - let mut filtered_chunks = vec![]; + let mut filtered_chunks = Vec::with_capacity(chunk_ids.len()); for id in chunk_ids { filtered_chunks.push( chunk_data diff --git a/read_buffer/src/row_group.rs b/read_buffer/src/row_group.rs index 75c9a4741d..8e8a5c5629 100644 --- a/read_buffer/src/row_group.rs +++ b/read_buffer/src/row_group.rs @@ -923,10 +923,10 @@ impl RowGroup { dst.aggregates.push(AggregateResults(aggregate_row)); // write the row } - /// Given the optional predicate, determines a set of rows contained in this - /// row group that satisfy it. Any column that contains a non-null value at - /// any of these row positions is then included in the results, which are - /// added to `dst`. + /// Given the predicate (which may be empty), determine a set of rows + /// contained in this row group that satisfy it. Any column that contains a + /// non-null value at any of these row positions is then included in the + /// results, which are added to `dst`. /// /// As an optimisation, the contents of `dst` are checked before execution /// and any columns already existing in the set are not interrogated.