mustafasrepo commented on code in PR #4455:
URL: https://github.com/apache/arrow-datafusion/pull/4455#discussion_r1037167340


##########
datafusion/core/src/physical_plan/windows/window_agg_exec.rs:
##########
@@ -116,14 +150,38 @@ impl ExecutionPlan for WindowAggExec {
 
     /// Get the output partitioning of this plan
     fn output_partitioning(&self) -> Partitioning {
-        // because we can have repartitioning using the partition keys
-        // this would be either 1 or more than 1 depending on the presense of
-        // repartitioning
-        self.input.output_partitioning()
+        // Although WindowAggExec does not change the output partitioning from 
the input, but can not return the output partitioning
+        // from the input directly, need to adjust the column index to align 
with the new schema.
+        let window_expr_len = self.window_expr.len();
+        let input_partitioning = self.input.output_partitioning();
+        match input_partitioning {
+            Partitioning::RoundRobinBatch(size) => 
Partitioning::RoundRobinBatch(size),
+            Partitioning::UnknownPartitioning(size) => {
+                Partitioning::UnknownPartitioning(size)
+            }
+            Partitioning::Hash(exprs, size) => {
+                let new_exprs = exprs
+                    .into_iter()
+                    .map(|expr| {
+                        expr.transform_down(

Review Comment:
   > If you do not mind, you can also show me your code, let's take a look and 
figure out how to make them work and be consistent with the current design.
   
   Sure,  we do check for the input ordering here (inside `create_initial_plan`)
   > 
   > 
https://github.com/apache/arrow-datafusion/blob/617f39e2d52915ee9cd91f9e19e44f46f567d303/datafusion/core/src/physical_plan/planner.rs#L573-L594
   > 
   
   
   
   



-- 
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]

Reply via email to