tokoko commented on code in PR #13023:
URL: https://github.com/apache/datafusion/pull/13023#discussion_r1809271608
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -937,72 +937,42 @@ pub async fn from_substrait_rel(
}
}
Some(RelType::Set(set)) => match set_rel::SetOp::try_from(set.op) {
- Ok(set_op) => match set_op {
- set_rel::SetOp::UnionAll => {
- if !set.inputs.is_empty() {
- union_rels(&set.inputs, ctx, extensions, true).await
- } else {
- not_impl_err!("Union relation requires at least one
input")
- }
- }
- set_rel::SetOp::UnionDistinct => {
- if !set.inputs.is_empty() {
- union_rels(&set.inputs, ctx, extensions, false).await
- } else {
- not_impl_err!("Union relation requires at least one
input")
- }
- }
- set_rel::SetOp::IntersectionPrimary => {
- if set.inputs.len() >= 2 {
- LogicalPlanBuilder::intersect(
- from_substrait_rel(ctx, &set.inputs[0],
extensions).await?,
- union_rels(&set.inputs[1..], ctx, extensions,
true).await?,
- false,
- )
- } else {
- not_impl_err!(
- "Primary Intersect relation requires at least two
inputs"
- )
- }
- }
- set_rel::SetOp::IntersectionMultiset => {
- if set.inputs.len() >= 2 {
- intersect_rels(&set.inputs, ctx, extensions,
false).await
- } else {
- not_impl_err!(
- "Multiset Intersect relation requires at least two
inputs"
- )
- }
- }
- set_rel::SetOp::IntersectionMultisetAll => {
- if set.inputs.len() >= 2 {
- intersect_rels(&set.inputs, ctx, extensions,
true).await
- } else {
- not_impl_err!(
- "MultisetAll Intersect relation requires at least
two inputs"
- )
- }
- }
- set_rel::SetOp::MinusPrimary => {
- if set.inputs.len() >= 2 {
- except_rels(&set.inputs, ctx, extensions, false).await
- } else {
- not_impl_err!(
- "Primary Minus relation requires at least two
inputs"
- )
- }
- }
- set_rel::SetOp::MinusPrimaryAll => {
- if set.inputs.len() >= 2 {
- except_rels(&set.inputs, ctx, extensions, true).await
- } else {
- not_impl_err!(
- "PrimaryAll Minus relation requires at least two
inputs"
- )
+ Ok(set_op) => {
+ if set.inputs.len() >= 2 {
Review Comment:
Can't really judge if it's idiomatic or not with my whole 2 weeks of rust
experience :laughing: but makes sense. I'll flip it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]