risingwave_frontend/optimizer/plan_node/generic/
recursive_union.rs1use pretty_xmlish::StrAssocArr;
16use risingwave_common::catalog::Schema;
17
18use super::{GenericPlanNode, GenericPlanRef, impl_distill_unit_from_fields};
19use crate::OptimizerContextRef;
20use crate::binder::ShareId;
21use crate::optimizer::property::FunctionalDependencySet;
22
23#[derive(Debug, Clone, PartialEq, Eq, Hash)]
26pub struct RecursiveUnion<PlanRef> {
27 pub id: ShareId,
28 pub base: PlanRef,
29 pub recursive: PlanRef,
30}
31
32impl<PlanRef: GenericPlanRef> GenericPlanNode for RecursiveUnion<PlanRef> {
33 fn functional_dependency(&self) -> FunctionalDependencySet {
34 self.recursive.functional_dependency().clone()
35 }
36
37 fn schema(&self) -> Schema {
38 self.recursive.schema().clone()
39 }
40
41 fn stream_key(&self) -> Option<Vec<usize>> {
42 let fields_len = self.base.schema().len();
43 let base = self.base.stream_key();
44 if let Some(base) = base {
45 let mut base = base.to_vec();
46 base.push(fields_len);
47 Some(base)
48 } else {
49 None
50 }
51 }
52
53 fn ctx(&self) -> OptimizerContextRef {
54 self.recursive.ctx()
55 }
56}
57
58impl<PlanRef: GenericPlanRef> RecursiveUnion<PlanRef> {
59 pub fn fields_pretty<'a>(&self) -> StrAssocArr<'a> {
60 vec![]
61 }
62}
63
64impl_distill_unit_from_fields!(RecursiveUnion, GenericPlanRef);