xudong963 commented on code in PR #14569: URL: https://github.com/apache/datafusion/pull/14569#discussion_r1948524638
########## datafusion/core/tests/physical_optimizer/enforce_sorting.rs: ########## @@ -1943,6 +1943,30 @@ async fn test_remove_unnecessary_spm1() -> Result<()> { Ok(()) } +#[tokio::test] +async fn test_remove_unnecessary_spm2() -> Result<()> { + let schema = create_test_schema()?; + let source = memory_exec(&schema); + let input = sort_preserving_merge_exec_with_fetch( + vec![sort_expr("non_nullable_col", &schema)], + source, + 100, + ); + + let expected_input = [ + "SortPreservingMergeExec: [non_nullable_col@1 ASC], fetch=100", + " DataSourceExec: partitions=1, partition_sizes=[0]", + ]; + let expected_optimized = [ + "SortPreservingMergeExec: [non_nullable_col@1 ASC], fetch=100", Review Comment: Please take a look at my fix. It's also okay that we don't maintain the SPM and add an extra `LocalLimit` -- 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