athena_rs 3.26.3

Hyper performant polyglot Database driver
//! Relation-mismatch aggregation helpers for `/debug/schema` still-needed diagnostics.
//!
//! This module isolates relation-type mismatch key derivation from overall
//! still-needed response orchestration.

use std::collections::BTreeSet;

use super::debug_evaluation::ExpectedTablesEvaluation;
use super::debug_observed_tables::relation_key;

/// Collects relation keys for expected tables whose discovered relation type mismatched.
pub(super) fn collect_relation_type_mismatch_keys(
    evaluation: &ExpectedTablesEvaluation,
) -> Vec<String> {
    evaluation
        .expected_tables
        .iter()
        .filter(|row| row.found && !row.relation_type_matches)
        .map(|row| relation_key(&row.table_schema, &row.table_name))
        .collect::<BTreeSet<String>>()
        .into_iter()
        .collect()
}