risingwave_frontend/optimizer/plan_node/generic/
mod.rs1use std::borrow::Cow;
19use std::hash::Hash;
20
21use pretty_xmlish::XmlNode;
22use risingwave_common::catalog::Schema;
23
24use super::{EqJoinPredicate, PlanNodeId};
25use crate::optimizer::optimizer_context::OptimizerContextRef;
26use crate::optimizer::property::{Distribution, FunctionalDependencySet};
27
28pub mod dynamic_filter;
29pub use dynamic_filter::*;
30mod hop_window;
31pub use hop_window::*;
32mod agg;
33pub use agg::*;
34mod project_set;
35pub use project_set::*;
36mod join;
37pub use join::*;
38mod project;
39pub use project::*;
40mod filter;
41pub use filter::*;
42mod expand;
43pub use expand::*;
44mod source;
45pub use source::*;
46mod table_scan;
47pub use table_scan::*;
48mod sys_scan;
49pub use sys_scan::*;
50mod log_scan;
51pub use log_scan::*;
52
53mod cdc_scan;
54pub use cdc_scan::*;
55
56mod union;
57pub use union::*;
58mod top_n;
59pub use top_n::*;
60mod share;
61pub use share::*;
62mod dedup;
63pub use dedup::*;
64mod intersect;
65pub use intersect::*;
66mod over_window;
67pub use over_window::*;
68mod except;
69pub use except::*;
70mod update;
71pub use update::*;
72mod delete;
73pub use delete::*;
74mod insert;
75pub use insert::*;
76mod limit;
77pub use limit::*;
78mod max_one_row;
79pub use max_one_row::*;
80mod cte_ref;
81pub use cte_ref::*;
82mod recursive_union;
83pub use recursive_union::*;
84mod changelog;
85pub use changelog::*;
86mod now;
87pub use now::*;
88
89mod file_scan;
90pub use file_scan::*;
91
92mod postgres_query;
93pub use postgres_query::*;
94
95mod mysql_query;
96
97pub use mysql_query::*;
98
99mod locality_provider;
100pub use locality_provider::*;
101
102mod vector_index_lookup_join;
103pub use vector_index_lookup_join::*;
104
105pub trait DistillUnit {
106 fn distill_with_name<'a>(&self, name: impl Into<Cow<'a, str>>) -> XmlNode<'a>;
107}
108
109macro_rules! impl_distill_unit_from_fields {
110 ($name:ident, $bound:path) => {
111 use std::borrow::Cow;
112
113 use pretty_xmlish::XmlNode;
114 use $crate::optimizer::plan_node::generic::DistillUnit;
115 impl<PlanRef: $bound> DistillUnit for $name<PlanRef> {
116 fn distill_with_name<'a>(&self, name: impl Into<Cow<'a, str>>) -> XmlNode<'a> {
117 XmlNode::simple_record(name, self.fields_pretty(), vec![])
118 }
119 }
120 };
121}
122pub(super) use impl_distill_unit_from_fields;
123
124#[auto_impl::auto_impl(&)]
125pub trait GenericPlanRef: Eq + Hash {
126 fn id(&self) -> PlanNodeId;
127 fn schema(&self) -> &Schema;
128 fn stream_key(&self) -> Option<&[usize]>;
129 fn functional_dependency(&self) -> &FunctionalDependencySet;
130 fn ctx(&self) -> OptimizerContextRef;
131}
132
133#[auto_impl::auto_impl(&)]
134pub trait PhysicalPlanRef: GenericPlanRef {
135 fn distribution(&self) -> &Distribution;
136}
137
138pub trait GenericPlanNode {
139 fn functional_dependency(&self) -> FunctionalDependencySet;
140 fn schema(&self) -> Schema;
141 fn stream_key(&self) -> Option<Vec<usize>>;
142 fn ctx(&self) -> OptimizerContextRef;
143}