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