quill_sql/plan/logical_plan/
join.rs1use crate::catalog::SchemaRef;
2use crate::expression::Expr;
3use crate::plan::logical_plan::LogicalPlan;
4use std::sync::Arc;
5
6#[derive(derive_new::new, Debug, Clone)]
7pub struct Join {
8 pub left: Arc<LogicalPlan>,
9 pub right: Arc<LogicalPlan>,
10 pub join_type: JoinType,
11 pub condition: Option<Expr>,
12 pub schema: SchemaRef,
13}
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq)]
16pub enum JoinType {
17 Inner,
19 LeftOuter,
21 RightOuter,
23 FullOuter,
25 Cross,
28}
29
30impl std::fmt::Display for Join {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 write!(f, "{} Join", self.join_type)?;
33 if let Some(condition) = self.condition.as_ref() {
34 write!(f, ": On {condition}")?;
35 }
36 Ok(())
37 }
38}
39
40impl std::fmt::Display for JoinType {
41 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42 write!(f, "{self:?}")
43 }
44}