MCPcopy Create free account
hub / github.com/apache/datafusion / set_operation_to_plan

Method set_operation_to_plan

datafusion/sql/src/set_expr.rs:134–179  ·  view source on GitHub ↗
(
        &self,
        op: SetOperator,
        left_plan: LogicalPlan,
        right_plan: LogicalPlan,
        set_quantifier: SetQuantifier,
    )

Source from the content-addressed store, hash-verified

132 }
133
134 pub(super) fn set_operation_to_plan(
135 &self,
136 op: SetOperator,
137 left_plan: LogicalPlan,
138 right_plan: LogicalPlan,
139 set_quantifier: SetQuantifier,
140 ) -> Result<LogicalPlan> {
141 match (op, set_quantifier) {
142 (SetOperator::Union, SetQuantifier::All) => {
143 LogicalPlanBuilder::from(left_plan)
144 .union(right_plan)?
145 .build()
146 }
147 (SetOperator::Union, SetQuantifier::AllByName) => {
148 LogicalPlanBuilder::from(left_plan)
149 .union_by_name(right_plan)?
150 .build()
151 }
152 (SetOperator::Union, SetQuantifier::Distinct | SetQuantifier::None) => {
153 LogicalPlanBuilder::from(left_plan)
154 .union_distinct(right_plan)?
155 .build()
156 }
157 (
158 SetOperator::Union,
159 SetQuantifier::ByName | SetQuantifier::DistinctByName,
160 ) => LogicalPlanBuilder::from(left_plan)
161 .union_by_name_distinct(right_plan)?
162 .build(),
163 (SetOperator::Intersect, SetQuantifier::All) => {
164 LogicalPlanBuilder::intersect(left_plan, right_plan, true)
165 }
166 (SetOperator::Intersect, SetQuantifier::Distinct | SetQuantifier::None) => {
167 LogicalPlanBuilder::intersect(left_plan, right_plan, false)
168 }
169 (SetOperator::Except, SetQuantifier::All) => {
170 LogicalPlanBuilder::except(left_plan, right_plan, true)
171 }
172 (SetOperator::Except, SetQuantifier::Distinct | SetQuantifier::None) => {
173 LogicalPlanBuilder::except(left_plan, right_plan, false)
174 }
175 (op, quantifier) => {
176 not_impl_err!("{op} {quantifier} not implemented")
177 }
178 }
179 }
180}

Callers 3

recursive_cteMethod · 0.80
set_expr_to_planMethod · 0.80
pipe_operator_setMethod · 0.80

Calls 7

exceptFunction · 0.85
intersectFunction · 0.50
buildMethod · 0.45
unionMethod · 0.45
union_by_nameMethod · 0.45
union_distinctMethod · 0.45

Tested by

no test coverage detected