diff --git a/read_buffer/benches/row_group.rs b/read_buffer/benches/row_group.rs index fb243998da..c8c141aa25 100644 --- a/read_buffer/benches/row_group.rs +++ b/read_buffer/benches/row_group.rs @@ -150,7 +150,7 @@ fn benchmark_read_group_vary_cardinality( &expected_cardinality, |b, expected_cardinality| { b.iter(|| { - let result = row_group.read_group( + let result = row_group.read_aggregate( predicate, group_cols.as_slice(), &[("duration", AggregateType::Count)], @@ -192,7 +192,7 @@ fn benchmark_read_group_vary_rows( )), |b| { b.iter(|| { - let result = row_group.read_group( + let result = row_group.read_aggregate( predicate, group_columns.0.as_slice(), &[("duration", AggregateType::Count)], @@ -231,7 +231,7 @@ fn benchmark_read_group_vary_group_cols( &group_cols, |b, group_cols| { b.iter(|| { - let result = row_group.read_group( + let result = row_group.read_aggregate( predicates, group_cols.as_slice(), &[("duration", AggregateType::Count)], diff --git a/read_buffer/src/row_group.rs b/read_buffer/src/row_group.rs index 832437ce70..0ad3f77678 100644 --- a/read_buffer/src/row_group.rs +++ b/read_buffer/src/row_group.rs @@ -333,15 +333,16 @@ impl RowGroup { ) } - /// Returns a set of group keys and aggregated column data associated with - /// them. `read_group` currently only supports grouping on columns that have - /// integer encoded representations - typically "tag columns". + /// Materialises a collection of data in group columns and aggregate + /// columns, optionally filtered by the provided predicate. /// - /// Right now, predicates are treated conjunctive (AND) predicates. - /// `read_group` does not guarantee any sort order. Ordering of results - /// should be handled high up in the `Table` section of the Read Buffer, - /// where multiple `RowGroup` results may need to be merged. - pub fn read_group( + /// Collectively, row-wise values in the group columns comprise a "group + /// key", and each value in the same row for the aggregate columns contains + /// aggregate values for those group keys. + /// + /// Note: `read_aggregate` currently only supports "tag" columns. + /// Note: `read_aggregate` does not order results. + pub fn read_aggregate( &self, predicate: &Predicate, group_columns: &[ColumnName<'_>], @@ -1745,7 +1746,7 @@ west,prod,POST,4 ]; for (predicate, group_cols, aggs, expected) in cases { - let mut results = row_group.read_group(&predicate, &group_cols, &aggs); + let mut results = row_group.read_aggregate(&predicate, &group_cols, &aggs); results.sort(); assert_eq!(format!("{:?}", &results), expected); } @@ -1769,7 +1770,7 @@ west,POST,prod,Bravo,two,203 )]; for (predicate, group_cols, aggs, expected) in cases { - let mut results = row_group.read_group(&predicate, &group_cols, &aggs); + let mut results = row_group.read_aggregate(&predicate, &group_cols, &aggs); results.sort(); assert_eq!(format!("{:?}", &results), expected); } @@ -1789,7 +1790,7 @@ PUT,203 )]; for (predicate, group_cols, aggs, expected) in cases { - let mut results = row_group.read_group(&predicate, &group_cols, &aggs); + let mut results = row_group.read_aggregate(&predicate, &group_cols, &aggs); results.sort(); assert_eq!(format!("{:?}", &results), expected); } @@ -1850,7 +1851,7 @@ west,POST,304,101,203 ]; for (predicate, group_cols, aggs, expected) in cases { - let results = row_group.read_group(&predicate, &group_cols, &aggs); + let results = row_group.read_aggregate(&predicate, &group_cols, &aggs); assert_eq!(format!("{:?}", &results), expected); } } diff --git a/read_buffer/src/table.rs b/read_buffer/src/table.rs index 9db54b7261..abc32b8d81 100644 --- a/read_buffer/src/table.rs +++ b/read_buffer/src/table.rs @@ -216,7 +216,7 @@ impl Table { results.values.reserve(row_groups.len()); for row_group in row_groups { - let segment_result = row_group.read_group(&predicate, &group_columns, &aggregates); + let segment_result = row_group.read_aggregate(&predicate, &group_columns, &aggregates); results.values.push(segment_result); }