pub fn column_values<'a>(
        &'a self,
        predicate: &Predicate,
        columns: &[ColumnName<'_>],
        mut dst: BTreeMap<String, BTreeSet<String>>,
    ) -> BTreeMap<String, BTreeSet<String>> {
        // Build up candidate columns
        let candidate_columns = self
            .all_columns_by_name
            .iter()
            // Filter any columns that are not present in the `Selection`.
            .filter_map(|(name, &id)| {
                if columns.iter().any(|selection| name == selection) {
                    Some((name, &self.columns[id]))
                } else {
                    None
                }
            })
            // Further filter candidate columns by removing any columns that we
            // can prove we already have all the distinct values for.
            .filter(|(name, column)| {
                match dst.get(*name) {
                    // process the column if we haven't got all the distinct
                    // values.
                    Some(values) => column.has_other_non_null_string_values(values),
                    // no existing values for this column - we will need to
                    // process it.
                    None => true,
                }
            })
            .collect::<Vec<_>>();

        let row_ids = self.row_ids_from_predicate(predicate);
        for (name, column) in candidate_columns {
            // If no rows match there is nothing to do, if some rows match then
            // extract an iterator of those IDs. If all rows match then create
            // an iterator of all rows without materialising them.
            let row_itr: Box<dyn Iterator<Item = u32>> = match &row_ids {
                RowIDsOption::None(_) => return dst,
                RowIDsOption::Some(row_ids) => Box::new(row_ids.iter()),
                RowIDsOption::All(_) => Box::new(0..self.rows()),
            };

            let results = dst.entry(name.clone()).or_default();
            for value in column.distinct_values(row_itr).into_iter() {
                if let Some(v) = value {
                    if !results.contains(v) {
                        results.insert(v.to_owned());
                    }
                }
            }
        }

        dst
    }
/// Returns the distinct set of values for the selected columns, constrained
/// by an optional predicate.
Returns the distinct set of values for the selected columns, constrained
by an optional predicate.
Returns the distinct set of values for the selected columns constrained by an optional predicate .
pub fn column_values<'a>(
        &'a self,
        predicate: &Predicate,
        columns: &[ColumnName<'_>],
        mut dst: BTreeMap<String, BTreeSet<String>>,
    ) -> BTreeMap<String, BTreeSet<String>> {
        // Build up candidate columns
        let candidate_columns = self
            .all_columns_by_name
            .iter()
            // Filter any columns that are not present in the `Selection`.
            .filter_map(|(name, &id)| {
                if columns.iter().any(|selection| name == selection) {
                    Some((name, &self.columns[id]))
                } else {
                    None
                }
            })
            // Further filter candidate columns by removing any columns that we
            // can prove we already have all the distinct values for.
            .filter(|(name, column)| {
                match dst.get(*name) {
                    // process the column if we haven't got all the distinct
                    // values.
                    Some(values) => column.has_other_non_null_string_values(values),
                    // no existing values for this column - we will need to
                    // process it.
                    None => true,
                }
            })
            .collect::<Vec<_>>();
        let row_ids = self.row_ids_from_predicate(predicate);
        for (name, column) in candidate_columns {
            // If no rows match there is nothing to do, if some rows match then
            // extract an iterator of those IDs. If all rows match then create
            // an iterator of all rows without materialising them.
            let row_itr: Box<dyn Iterator<Item = u32>> = match &row_ids {
                RowIDsOption::None(_) => return dst,
                RowIDsOption::Some(row_ids) => Box::new(row_ids.iter()),
                RowIDsOption::All(_) => Box::new(0..self.rows()),
            };
            let results = dst.entry(name.clone()).or_default();
            for value in column.distinct_values(row_itr).into_iter() {
                if let Some(v) = value {
                    if !results.contains(v) {
                        results.insert(v.to_owned());
                    }
                }
            }
        }
        dst
    }
pub fn column_values < ' a > ( & ' a self , predicate : & Predicate , columns : & [ ColumnName < ' _ > ] , mut dst : BTreeMap < String , BTreeSet < String > > , ) -> BTreeMap < String , BTreeSet < String > > { // Build up candidate columns let candidate_columns = self . all_columns_by_name . iter ( ) // Filter any columns that are not present in the `Selection`. . filter_map ( | ( name , & id ) | { if columns . iter ( ) . any ( | selection | name == selection ) { Some ( ( name , & self . columns [ id ] ) ) } else { None } } ) // Further filter candidate columns by removing any columns that we // can prove we already have all the distinct values for. . filter ( | ( name , column ) | { match dst . get ( * name ) { // process the column if we haven't got all the distinct // values. Some ( values ) => column . has_other_non_null_string_values ( values ) , // no existing values for this column - we will need to // process it. None => true , } } ) . collect :: < Vec < _ > > ( ) ; let row_ids = self . row_ids_from_predicate ( predicate ) ; for ( name , column ) in candidate_columns { // If no rows match there is nothing to do, if some rows match then // extract an iterator of those IDs. If all rows match then create // an iterator of all rows without materialising them. let row_itr : Box < dyn Iterator < Item = u32 > > = match & row_ids { RowIDsOption :: None ( _ ) => return dst , RowIDsOption :: Some ( row_ids ) => Box :: new ( row_ids . iter ( ) ) , RowIDsOption :: All ( _ ) => Box :: new ( 0 .. self . rows ( ) ) , } ; let results = dst . entry ( name . clone ( ) ) . or_default ( ) ; for value in column . distinct_values ( row_itr ) . into_iter ( ) { if let Some ( v ) = value { if ! results . contains ( v ) { results . insert ( v . to_owned ( ) ) ; } } } } dst }
Returns the distinct set of values for the selected columns, constrained
by an optional predicate.
Returns the distinct set of values for the selected columns constrained by an optional predicate .
&'a self
predicate
&Predicate
columns
&[ColumnName<'_>]
dst
BTreeMap<String, BTreeSet<String>>
&'a self
predicate
&Predicate
columns
&[ColumnName<'_>]
dst
BTreeMap<String, BTreeSet<String>>