alamb commented on code in PR #12495:
URL: https://github.com/apache/datafusion/pull/12495#discussion_r1763640110
##########
datafusion/substrait/src/logical_plan/producer.rs:
##########
@@ -432,38 +445,39 @@ pub fn to_substrait_rel(
}
LogicalPlan::Window(window) => {
let input = to_substrait_rel(window.input.as_ref(), ctx,
extensions)?;
- // If the input is a Project relation, we can just append the
WindowFunction expressions
- // before returning
- // Otherwise, wrap the input in a Project relation before
appending the WindowFunction
- // expressions
- let mut project_rel: Box<ProjectRel> = match
&input.as_ref().rel_type {
- Some(RelType::Project(p)) => Box::new(*p.clone()),
- _ => {
- // Create Projection with field referencing all output
fields in the input relation
- let expressions = (0..window.input.schema().fields().len())
- .map(substrait_field_ref)
- .collect::<Result<Vec<_>>>()?;
- Box::new(ProjectRel {
- common: None,
- input: Some(input),
- expressions,
- advanced_extension: None,
- })
- }
- };
Review Comment:
Yes, the datafusion optimizer already handles projection pushdown quite well
-- so keeping the substrait producer simpler makes the most sense to me
--
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]