vbarua commented on code in PR #13127:
URL: https://github.com/apache/datafusion/pull/13127#discussion_r1826045355


##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1053,15 +1077,123 @@ pub async fn from_substrait_rel(
                     return not_impl_err!("Unsupported exchange kind: 
{exchange_kind:?}");
                 }
             };
-            Ok(LogicalPlan::Repartition(Repartition {
+            let plan = LogicalPlan::Repartition(Repartition {
                 input,
                 partitioning_scheme,
-            }))
+            });
+            apply_emit_kind(exchange.common.as_ref(), plan)
         }
         _ => not_impl_err!("Unsupported RelType: {:?}", rel.rel_type),
     }
 }
 
+fn retrieve_emit_kind(rel_common: Option<&RelCommon>) -> EmitKind {
+    // the default EmitKind is Direct if it is not set explicitly
+    let default = EmitKind::Direct(rel_common::Direct {});
+    rel_common
+        .and_then(|rc| rc.emit_kind.as_ref())
+        .map_or(default, |ek| ek.clone())
+}
+
+fn contains_volatile_expr(proj: &Projection) -> Result<bool> {

Review Comment:
   > but what if it's a fairly complicated subquery expression that's being 
repeated?
   
   My motivation for the special case inlining for projections isn't for 
performance but primarily for plan readability. Inlining volatile expression 
results in incorrect plans, but inlining expensive expression does not, just 
more expensive plans. I'm going to choose to leave that as a follow-up and/or 
punt to the optimizer if that's okay?
   
   



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to