dbt-labs/dbt-core · error

count_occurrences_of_value_in_column

Error message

count_occurrences_of_value_in_column

What it means

Unimplemented agate Table method: count_occurrences_of_value_in_column should count how many times a needle Value appears in the given column, but the body is a todo!() stub (the column is already extracted and unwrapped). Any lookup/count macro hitting it aborts.

Solutions

  1. Count needle occurrences in the extracted column using agate value equality
  2. Handle nulls and cross-type comparisons consistently with Python agate
  3. Return an unsupported error instead of panicking until implemented
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/dbt-agate/src/table.rs:245 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/1f6822ea558854ce. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-agate/src/table.rs:245

    pub fn column_without_nulls(&self, col_idx: isize) -> Arc<Self> {
        let _col = self.single_column_table(col_idx).unwrap();
        todo!("column_without_nulls")
    }

    pub fn column_sorted(&self, col_idx: isize) -> Arc<Self> {
        let _col = self.single_column_table(col_idx).unwrap();
        todo!("column_sorted")
    }

    pub fn column_without_nulls_sorted(&self, col_idx: isize) -> Arc<Self> {
        let _col = self.single_column_table(col_idx).unwrap();
        todo!("column_without_nulls_sorted")
    }

    pub fn count_occurrences_of_value_in_column(&self, _needle: &Value, col_idx: isize) -> usize {
        let _col = self.single_column_table(col_idx).unwrap();
        todo!("count_occurrences_of_value_in_column")
    }

    pub fn index_of_value_in_column(&self, _needle: &Value, col_idx: isize) -> Option<usize> {
        let _col = self.single_column_table(col_idx).unwrap();
        todo!("index_of_value_in_column")
    }

    fn with_renamed_columns(&self, renamed_columns: Vec<String>) -> Arc<Self> {
        debug_assert!(renamed_columns.len() == self.num_columns());
        let new_batch = self.flat.with_renamed_columns(&renamed_columns);
        let new_vec_of_rows = self.peek_row_table().map(Arc::clone);
        let row_names = self.row_names.as_ref().map(Arc::clone);
        let repr = TableRepr::new(new_batch, new_vec_of_rows, row_names);
        Arc::new(repr)
    }

    fn with_renamed_rows(&self, renamed_columns: Arc<StringViewArray>) -> Arc<Self> {
        debug_assert!(renamed_columns.len() == self.num_rows());

View on GitHub (pinned to 0267ce9170)