#[derive(Debug, Clone)]
pub struct TableInfo {
pub id: String,
pub estimated_rows: u64,
pub selectivity: f64,
pub has_index: bool,
pub bit_id: u32,
}
impl TableInfo {
pub fn new(id: String, estimated_rows: u64) -> Self {
Self {
id,
estimated_rows,
selectivity: 1.0,
has_index: false,
bit_id: 0,
}
}
pub fn with_selectivity(mut self, selectivity: f64) -> Self {
self.selectivity = selectivity.clamp(0.0, 1.0);
self
}
pub fn with_index(mut self, has_index: bool) -> Self {
self.has_index = has_index;
self
}
pub fn with_bit_id(mut self, bit_id: u32) -> Self {
self.bit_id = bit_id;
self
}
}