Blizzara commented on code in PR #12495:
URL: https://github.com/apache/datafusion/pull/12495#discussion_r1766422065
##########
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,
- })
- }
- };
- // Parse WindowFunction expression
- let mut window_exprs = vec![];
+
+ // create a field reference for each input field
+ let mut expressions = (0..window.input.schema().fields().len())
Review Comment:
I guess you could not add these ref expressions, and then use a direct emit
(or remap starting from 0) instead, would that not be the same? That said it'd
break roundtrip until you've gotten the consumer part done as well 😅
--
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]