catalog/system_schema/
numbers_table_provider.rs1#[cfg(any(test, feature = "testing", debug_assertions))]
16use common_catalog::consts::NUMBERS_TABLE_ID;
17use table::TableRef;
18#[cfg(any(test, feature = "testing", debug_assertions))]
19use table::table::numbers::NUMBERS_TABLE_NAME;
20#[cfg(any(test, feature = "testing", debug_assertions))]
21use table::table::numbers::NumbersTable;
22
23#[derive(Clone)]
25pub struct NumbersTableProvider;
26
27#[cfg(any(test, feature = "testing", debug_assertions))]
28impl NumbersTableProvider {
29 pub(crate) fn table_exists(&self, name: &str) -> bool {
30 name == NUMBERS_TABLE_NAME
31 }
32
33 pub(crate) fn table_names(&self) -> Vec<String> {
34 vec![NUMBERS_TABLE_NAME.to_string()]
35 }
36
37 pub(crate) fn table(&self, name: &str) -> Option<TableRef> {
38 if name == NUMBERS_TABLE_NAME {
39 Some(NumbersTable::table(NUMBERS_TABLE_ID))
40 } else {
41 None
42 }
43 }
44}
45
46#[cfg(not(any(test, feature = "testing", debug_assertions)))]
47impl NumbersTableProvider {
48 pub(crate) fn table_exists(&self, _name: &str) -> bool {
49 false
50 }
51
52 pub(crate) fn table_names(&self) -> Vec<String> {
53 vec![]
54 }
55
56 pub(crate) fn table(&self, _name: &str) -> Option<TableRef> {
57 None
58 }
59}