refactor: address PR feedback

Co-authored-by: Carol (Nichols || Goulding) <193874+carols10cents@users.noreply.github.com>
pull/24376/head
Edd Robinson 2021-02-05 13:06:35 +00:00
parent 48b29a9c72
commit f0748cc379
6 changed files with 9 additions and 13 deletions

View File

@ -258,7 +258,7 @@ impl Chunk {
} }
/// Returns the distinct set of column names that contain data matching the /// 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 /// `dst` is a buffer that will be populated with results. `column_names` is
/// smart enough to short-circuit processing on row groups when it /// smart enough to short-circuit processing on row groups when it

View File

@ -307,11 +307,7 @@ impl Bool {
/// Returns true if the column contains any non-null values at the rows /// Returns true if the column contains any non-null values at the rows
/// provided. /// provided.
pub fn has_non_null_value(&self, row_ids: &[u32]) -> bool { pub fn has_non_null_value(&self, row_ids: &[u32]) -> bool {
if !self.contains_null() { !self.contains_null() || row_ids.iter().any(|id| !self.arr.is_null(*id as usize))
return true;
}
row_ids.iter().any(|id| !self.arr.is_null(*id as usize))
} }
} }

View File

@ -670,7 +670,7 @@ impl Plain {
return true; 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. // value in the column.
self.entries.len() > 1 self.entries.len() > 1
} }

View File

@ -801,7 +801,7 @@ impl RLE {
return true; 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. // dictionary.
!self.entry_index.is_empty() !self.entry_index.is_empty()
} }

View File

@ -488,7 +488,7 @@ impl Database {
})?; })?;
let chunk_data = partition.data.read().unwrap(); 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 { for id in chunk_ids {
filtered_chunks.push( filtered_chunks.push(
chunk_data chunk_data

View File

@ -923,10 +923,10 @@ impl RowGroup {
dst.aggregates.push(AggregateResults(aggregate_row)); // write the row dst.aggregates.push(AggregateResults(aggregate_row)); // write the row
} }
/// Given the optional predicate, determines a set of rows contained in this /// Given the predicate (which may be empty), determine a set of rows
/// row group that satisfy it. Any column that contains a non-null value at /// contained in this row group that satisfy it. Any column that contains a
/// any of these row positions is then included in the results, which are /// non-null value at any of these row positions is then included in the
/// added to `dst`. /// results, which are added to `dst`.
/// ///
/// As an optimisation, the contents of `dst` are checked before execution /// As an optimisation, the contents of `dst` are checked before execution
/// and any columns already existing in the set are not interrogated. /// and any columns already existing in the set are not interrogated.