risingwave_frontend/optimizer/plan_visitor/
sys_table_visitor.rs1use super::{DefaultBehavior, Merge};
16use crate::PlanRef;
17use crate::optimizer::plan_node::{BatchSysSeqScan, LogicalSysScan, StreamTableScan};
18use crate::optimizer::plan_visitor::PlanVisitor;
19
20#[derive(Debug, Clone, Default)]
21pub struct SysTableVisitor {}
22
23impl SysTableVisitor {
24 pub fn has_sys_table(plan: PlanRef) -> bool {
25 let mut visitor = SysTableVisitor {};
26 visitor.visit(plan)
27 }
28}
29
30impl PlanVisitor for SysTableVisitor {
31 type Result = bool;
32
33 type DefaultBehavior = impl DefaultBehavior<Self::Result>;
34
35 fn default_behavior() -> Self::DefaultBehavior {
36 Merge(|a, b| a | b)
37 }
38
39 fn visit_batch_sys_seq_scan(&mut self, _batch_seq_scan: &BatchSysSeqScan) -> bool {
40 true
41 }
42
43 fn visit_logical_sys_scan(&mut self, _logical_scan: &LogicalSysScan) -> bool {
44 true
45 }
46
47 fn visit_stream_table_scan(&mut self, _stream_table_scan: &StreamTableScan) -> bool {
49 false
50 }
51}