use crate::{classification::DataType, source::FileFormat};
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct SchemaResult {
pub columns: Vec<ColumnSchema>,
pub rows_sampled: usize,
pub inference_time_ms: u128,
pub schema_stable: bool,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ColumnSchema {
pub name: String,
pub data_type: DataType,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct StructureReport {
pub source: String,
pub format: FileFormat,
pub row_count: RowCountEstimate,
pub rows_sampled: usize,
pub source_exhausted: bool,
pub truncated: bool,
pub truncation_reason: Option<String>,
pub delimiter: Option<String>,
pub columns: Vec<StructureColumnSummary>,
pub warnings: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct StructureColumnSummary {
pub name: String,
pub data_type: DataType,
pub total_count: Option<usize>,
pub null_count: Option<usize>,
pub null_ratio: Option<f64>,
pub unique_count: Option<usize>,
pub uniqueness_ratio: Option<f64>,
pub distinct_count_approximate: Option<bool>,
pub provenance: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RowCountEstimate {
pub count: u64,
pub exact: bool,
pub method: CountMethod,
pub count_time_ms: u128,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CountMethod {
ParquetMetadata,
FullScan,
Sampling,
StreamFullScan,
}