MCPcopy Create free account
hub / github.com/PerroEngine/Perro / candidate_rows

Method candidate_rows

perro_source/core/perro_csv/src/lib.rs:826–859  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

824 fn add_starts_with(mut self, logic: CsvLogic, col: &str, prefix: &str) -> Self {
825 self.filters.push(CsvFilter {
826 logic,
827 predicate: CsvPredicate::StartsWith {
828 col: self.col(col),
829 prefix: prefix.to_string(),
830 },
831 });
832 self
833 }
834
835 fn add_in(mut self, logic: CsvLogic, col: &str, values: &[&str]) -> Self {
836 self.filters.push(CsvFilter {
837 logic,
838 predicate: CsvPredicate::In {
839 col: self.col(col),
840 values: values.iter().map(|value| (*value).to_string()).collect(),
841 hashes: values
842 .iter()
843 .map(|value| perro_ids::string_to_u64(value))
844 .collect(),
845 },
846 });
847 self
848 }
849
850 fn col(&self, name: &str) -> usize {
851 self.table.header_index(name).unwrap_or(INVALID_COL)
852 }
853
854 fn matches(&self, row_idx: usize) -> bool {
855 let Some(first) = self.filters.first() else {
856 return true;
857 };
858 let mut matched = self.predicate_matches(row_idx, &first.predicate);
859 for filter in self.filters.iter().skip(1) {
860 if filter.logic == CsvLogic::And && !matched {
861 continue;
862 }

Callers 1

runMethod · 0.80

Calls 4

hash_indexMethod · 0.80
rows_for_hashMethod · 0.80
iterMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected