You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/22 19:47:17 UTC
[GitHub] [arrow-datafusion] alamb opened a new pull request, #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
alamb opened a new pull request, #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332
# Which issue does this PR close?
Closes https://github.com/apache/arrow-datafusion/issues/4331
# Rationale for this change
# What changes are included in this PR?
Teach optimizer that `CoalesceBatchesExec` does not destroy output order
# Are these changes tested?
TODO
# Are there any user-facing changes?
BasicEnforcement will not add unecessary `SortExec`s
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] mingmwang commented on pull request #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
Posted by GitBox <gi...@apache.org>.
mingmwang commented on PR #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332#issuecomment-1327077332
I think you can construct a UT to test and verify a sorted input stream is still keep sorted after `CoalesceBatchesExec`
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] ursabot commented on pull request #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332#issuecomment-1329557892
Benchmark runs are scheduled for baseline = dafd957288371597902c6af9df3f31a31ac418a2 and contender = a31b44eae236920d43ddd3ef7fadf8f9abf18976. a31b44eae236920d43ddd3ef7fadf8f9abf18976 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/b40c29c114fa4db2b0e7c714973b236c...9d1f3af96d724a329fe5ba36dd3fbd28/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/84d34c27d69449b99d7a401839b760c8...3c10de84e1f547399dd9edb906337967/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/8005001d04ef40fc9c1793d7fb1c3d74...b5b72ab9db7a470a9958caf1ced535e5/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/8d5e772e31fe453591cb9e0a92f3c84d...1bdd07ba7ade4d328f3d9690df3fe23e/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332#issuecomment-1324912031
i just need to figure out how to write a test for this PR and it will be ready
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332#discussion_r1033641778
##########
datafusion/core/src/physical_optimizer/enforcement.rs:
##########
@@ -2139,4 +2147,33 @@ mod tests {
assert_optimized!(expected, join);
Ok(())
}
+
+ #[test]
+ fn merge_does_not_need_sort() -> Result<()> {
+ // see https://github.com/apache/arrow-datafusion/issues/4331
+ let schema = schema();
+ let sort_key = vec![PhysicalSortExpr {
+ expr: col("a", &schema).unwrap(),
+ options: SortOptions::default(),
+ }];
+
+ // Scan some sorted parquet files
+ let exec = parquet_exec_with_sort(Some(sort_key.clone()));
+
+ // CoalesceBatchesExec to mimic behavior after a filter
+ let exec = Arc::new(CoalesceBatchesExec::new(exec, 4096));
+
+ // Merge from multiple parquet files and keep the data sorted
+ let exec = Arc::new(SortPreservingMergeExec::new(sort_key, exec));
+
+ // The optimizer should not add an additional SortExec as the
+ // data is already sorted
+ let expected = &[
Review Comment:
Here is the test (that mimics my usecase in IOx) -- without the changes in this PR this test fails (as there is a SortExec present)
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #4332: Teach optimizer that `CoalesceBatchesExec` does not destroy output order
Posted by GitBox <gi...@apache.org>.
alamb merged PR #4332:
URL: https://github.com/apache/arrow-datafusion/pull/4332
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org