fn aggregate_columns<'a>(&'a self, predicate: &Predicate, dst: &mut ReadAggregateResult<'a>) {
        let aggregate_columns = dst
            .schema
            .aggregate_columns
            .iter()
            .map(|(col_type, agg_type, _)| (self.column_by_name(col_type.as_str()), *agg_type))
            .collect::<Vec<_>>();

        let row_ids = match predicate.is_empty() {
            true => {
                // TODO(edd): PERF - teach each column encoding how to produce
                // an aggregate for all its rows without needed
                // to see the entire set of row ids. Currently
                // column encodings aggregate based on the slice
                // of row ids they see.
                (0..self.rows()).into_iter().collect::<Vec<u32>>()
            }
            false => match self.row_ids_from_predicate(predicate) {
                RowIDsOption::Some(row_ids) => row_ids.to_vec(),
                RowIDsOption::None(_) => vec![],
                RowIDsOption::All(_) => {
                    // see above comment.
                    (0..self.rows()).into_iter().collect::<Vec<u32>>()
                }
            },
        };

        // the single row that will store the aggregate column values.
        let mut aggregate_row = vec![];
        for (col, agg_type) in aggregate_columns {
            match agg_type {
                AggregateType::Count => {
                    aggregate_row.push(AggregateResult::Count(col.count(&row_ids) as u64));
                }
                AggregateType::Sum => {
                    aggregate_row.push(AggregateResult::Sum(col.sum(&row_ids)));
                }
                AggregateType::Min => {
                    aggregate_row.push(AggregateResult::Min(col.min(&row_ids)));
                }
                AggregateType::Max => {
                    aggregate_row.push(AggregateResult::Max(col.max(&row_ids)));
                }
                _ => unimplemented!("Other aggregates are not yet supported"),
            }
        }
        dst.aggregates.push(AggregateResults(aggregate_row)); // write the row
    }
// Applies aggregates on multiple columns with an optional predicate.
Applies aggregates on multiple columns with an optional predicate.
Applies aggregates on multiple columns with an optional predicate .
fn aggregate_columns<'a>(&'a self, predicate: &Predicate, dst: &mut ReadAggregateResult<'a>) {
        let aggregate_columns = dst
            .schema
            .aggregate_columns
            .iter()
            .map(|(col_type, agg_type, _)| (self.column_by_name(col_type.as_str()), *agg_type))
            .collect::<Vec<_>>();
        let row_ids = match predicate.is_empty() {
            true => {
                // TODO(edd): PERF - teach each column encoding how to produce
                // an aggregate for all its rows without needed
                // to see the entire set of row ids. Currently
                // column encodings aggregate based on the slice
                // of row ids they see.
                (0..self.rows()).into_iter().collect::<Vec<u32>>()
            }
            false => match self.row_ids_from_predicate(predicate) {
                RowIDsOption::Some(row_ids) => row_ids.to_vec(),
                RowIDsOption::None(_) => vec![],
                RowIDsOption::All(_) => {
                    // see above comment.
                    (0..self.rows()).into_iter().collect::<Vec<u32>>()
                }
            },
        };
        // the single row that will store the aggregate column values.
        let mut aggregate_row = vec![];
        for (col, agg_type) in aggregate_columns {
            match agg_type {
                AggregateType::Count => {
                    aggregate_row.push(AggregateResult::Count(col.count(&row_ids) as u64));
                }
                AggregateType::Sum => {
                    aggregate_row.push(AggregateResult::Sum(col.sum(&row_ids)));
                }
                AggregateType::Min => {
                    aggregate_row.push(AggregateResult::Min(col.min(&row_ids)));
                }
                AggregateType::Max => {
                    aggregate_row.push(AggregateResult::Max(col.max(&row_ids)));
                }
                _ => unimplemented!("Other aggregates are not yet supported"),
            }
        }
        dst.aggregates.push(AggregateResults(aggregate_row)); // write the row
    }
fn aggregate_columns < ' a > ( & ' a self , predicate : & Predicate , dst : & mut ReadAggregateResult < ' a > ) { let aggregate_columns = dst . schema . aggregate_columns . iter ( ) . map ( | ( col_type , agg_type , _ ) | ( self . column_by_name ( col_type . as_str ( ) ) , * agg_type ) ) . collect :: < Vec < _ > > ( ) ; let row_ids = match predicate . is_empty ( ) { true => { // TODO(edd): PERF - teach each column encoding how to produce // an aggregate for all its rows without needed // to see the entire set of row ids. Currently // column encodings aggregate based on the slice // of row ids they see. ( 0 .. self . rows ( ) ) . into_iter ( ) . collect :: < Vec < u32 > > ( ) } false => match self . row_ids_from_predicate ( predicate ) { RowIDsOption :: Some ( row_ids ) => row_ids . to_vec ( ) , RowIDsOption :: None ( _ ) => vec ! [ ] , RowIDsOption :: All ( _ ) => { // see above comment. ( 0 .. self . rows ( ) ) . into_iter ( ) . collect :: < Vec < u32 > > ( ) } } , } ; // the single row that will store the aggregate column values. let mut aggregate_row = vec ! [ ] ; for ( col , agg_type ) in aggregate_columns { match agg_type { AggregateType :: Count => { aggregate_row . push ( AggregateResult :: Count ( col . count ( & row_ids ) as u64 ) ) ; } AggregateType :: Sum => { aggregate_row . push ( AggregateResult :: Sum ( col . sum ( & row_ids ) ) ) ; } AggregateType :: Min => { aggregate_row . push ( AggregateResult :: Min ( col . min ( & row_ids ) ) ) ; } AggregateType :: Max => { aggregate_row . push ( AggregateResult :: Max ( col . max ( & row_ids ) ) ) ; } _ => unimplemented ! ( " " ) , } } dst . aggregates . push ( AggregateResults ( aggregate_row ) ) ; // write the row }
Applies aggregates on multiple columns with an optional predicate.
Applies aggregates on multiple columns with an optional predicate .
&'a self
predicate
&Predicate
dst
&mut ReadAggregateResult<'a>
&'a self
predicate
&Predicate
dst
&mut ReadAggregateResult<'a>