mustafasrepo commented on code in PR #4928:
URL: https://github.com/apache/arrow-datafusion/pull/4928#discussion_r1071822908
##########
datafusion/core/src/physical_optimizer/sort_enforcement.rs:
##########
@@ -664,32 +677,33 @@ mod tests {
Arc::new(WindowFrame::new(true)),
schema.as_ref(),
)?],
- sort_exec.clone(),
- sort_exec.schema(),
+ sort.clone(),
+ sort.schema(),
vec![],
Some(sort_exprs),
)?) as Arc<dyn ExecutionPlan>;
- let sort_exprs = vec![PhysicalSortExpr {
- expr: col("non_nullable_col",
window_agg_exec.schema().as_ref()).unwrap(),
- options: SortOptions {
+
+ let sort_exprs = vec![sort_expr_options(
+ "non_nullable_col",
+ &window_agg_exec.schema(),
+ SortOptions {
descending: false,
nulls_first: false,
},
- }];
- let sort_exec = Arc::new(SortExec::try_new(
- sort_exprs.clone(),
- window_agg_exec,
- None,
- )?) as Arc<dyn ExecutionPlan>;
+ )];
+
+ let sort = sort_exec(sort_exprs.clone(), window_agg_exec);
+
// Add dummy layer propagating Sort above, to test whether sort can be
removed from multi layer before
- let filter_exec = Arc::new(FilterExec::try_new(
+ let filter = filter_exec(
Arc::new(NotExpr::new(
col("non_nullable_col", schema.as_ref()).unwrap(),
)),
- sort_exec,
- )?) as Arc<dyn ExecutionPlan>;
+ sort,
+ );
+
// let filter_exec = sort_exec;
- let window_agg_exec = Arc::new(WindowAggExec::try_new(
+ let physical_plan = Arc::new(WindowAggExec::try_new(
Review Comment:
given util function `window_exec` is available we can construct
`physical_plan` with
``` rust
let physical_plan = window_exec(
filter.clone(),
filter.schema(),
&sort_exprs,
"non_nullable_col",
)?;
```
--
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]