linkrs_query/optimizer/cost_based/join_order/
table_info.rs1#[derive(Debug, Clone)]
5pub struct TableInfo {
6 pub id: String,
8 pub estimated_rows: u64,
10 pub selectivity: f64,
12 pub has_index: bool,
14 pub bit_id: u32,
16}
17
18impl TableInfo {
19 pub fn new(id: String, estimated_rows: u64) -> Self {
21 Self {
22 id,
23 estimated_rows,
24 selectivity: 1.0,
25 has_index: false,
26 bit_id: 0,
27 }
28 }
29
30 pub fn with_selectivity(mut self, selectivity: f64) -> Self {
32 self.selectivity = selectivity.clamp(0.0, 1.0);
33 self
34 }
35
36 pub fn with_index(mut self, has_index: bool) -> Self {
38 self.has_index = has_index;
39 self
40 }
41
42 pub fn with_bit_id(mut self, bit_id: u32) -> Self {
44 self.bit_id = bit_id;
45 self
46 }
47}