berkaysynnada commented on code in PR #14271: URL: https://github.com/apache/datafusion/pull/14271#discussion_r1935098072
########## datafusion/core/tests/physical_optimizer/enforce_sorting.rs: ########## @@ -238,6 +241,338 @@ async fn test_remove_unnecessary_sort5() -> Result<()> { Ok(()) } +#[test] +fn test_aggregate_set_monotonic_no_group() -> Result<()> { + let schema = create_test_schema4()?; + + let source = memory_exec(&schema); + + let sort_exprs = vec![sort_expr("a", &schema)]; + let sort = sort_exec(sort_exprs.clone(), source); + + let aggregate = aggregate_exec_set_monotonic(sort, vec![]); + + let sort_exprs = LexOrdering::new(vec![sort_expr("count", &aggregate.schema())]); + let physical_plan: Arc<dyn ExecutionPlan> = + Arc::new(SortExec::new(sort_exprs.clone(), aggregate)) as _; + + let expected_input = [ + "SortExec: expr=[count@0 ASC], preserve_partitioning=[false]", + " AggregateExec: mode=Single, gby=[], aggr=[count]", + " SortExec: expr=[a@0 ASC], preserve_partitioning=[false]", + " MemoryExec: partitions=1, partition_sizes=[0]", + ]; + + let expected_optimized = [ + "AggregateExec: mode=Single, gby=[], aggr=[count]", Review Comment: I see. I think what we are trying to utilize becomes only meaningful for window aggregations. I'll finalize the PR after talking with @ozankabak. -- 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