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