tokoko commented on code in PR #13127: URL: https://github.com/apache/datafusion/pull/13127#discussion_r1825117522
########## 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: okay, another one :laughing: I have a slight preference for checking for uniqueness rather than volatility. Volatility probably does take care of correctness issues, but what if it's a fairly complicated subquery expression that's being repeated? Uniqueness check feels safer to me as it definitely won't lead to performance issues on some strange edge cases. wdyt? -- 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