blaginin commented on code in PR #17962:
URL: https://github.com/apache/datafusion/pull/17962#discussion_r2414482009
##########
datafusion/core/tests/physical_optimizer/replace_with_order_preserving_variants.rs:
##########
@@ -200,66 +177,72 @@ async fn test_replace_multiple_input_repartition_1(
let sort = sort_exec_with_preserve_partitioning(sort_exprs.clone(),
repartition);
let physical_plan = sort_preserving_merge_exec(sort_exprs, sort);
- // Expected inputs unbounded and bounded
- let expected_input_unbounded = [
- "SortPreservingMergeExec: [a@0 ASC NULLS LAST]",
- " SortExec: expr=[a@0 ASC NULLS LAST],
preserve_partitioning=[true]",
- " RepartitionExec: partitioning=Hash([c@1], 8),
input_partitions=8",
- " RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1",
- " StreamingTableExec: partition_sizes=1, projection=[a, c,
d], infinite_source=true, output_ordering=[a@0 ASC NULLS LAST]",
- ];
- let expected_input_bounded = [
- "SortPreservingMergeExec: [a@0 ASC NULLS LAST]",
- " SortExec: expr=[a@0 ASC NULLS LAST],
preserve_partitioning=[true]",
- " RepartitionExec: partitioning=Hash([c@1], 8),
input_partitions=8",
- " RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1",
- " DataSourceExec: partitions=1, partition_sizes=[1],
output_ordering=a@0 ASC NULLS LAST",
- ];
-
- // Expected unbounded result (same for with and without flag)
- let expected_optimized_unbounded = [
- "SortPreservingMergeExec: [a@0 ASC NULLS LAST]",
- " RepartitionExec: partitioning=Hash([c@1], 8),
input_partitions=8, preserve_order=true, sort_exprs=a@0 ASC NULLS LAST",
- " RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1",
- " StreamingTableExec: partition_sizes=1, projection=[a, c,
d], infinite_source=true, output_ordering=[a@0 ASC NULLS LAST]",
- ];
-
- // Expected bounded results with and without flag
- let expected_optimized_bounded = [
- "SortPreservingMergeExec: [a@0 ASC NULLS LAST]",
- " SortExec: expr=[a@0 ASC NULLS LAST],
preserve_partitioning=[true]",
- " RepartitionExec: partitioning=Hash([c@1], 8),
input_partitions=8",
- " RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1",
- " DataSourceExec: partitions=1, partition_sizes=[1],
output_ordering=a@0 ASC NULLS LAST",
- ];
- let expected_optimized_bounded_sort_preserve = [
- "SortPreservingMergeExec: [a@0 ASC NULLS LAST]",
- " RepartitionExec: partitioning=Hash([c@1], 8),
input_partitions=8, preserve_order=true, sort_exprs=a@0 ASC NULLS LAST",
- " RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1",
- " DataSourceExec: partitions=1, partition_sizes=[1],
output_ordering=a@0 ASC NULLS LAST",
- ];
- assert_optimized_in_all_boundedness_situations!(
- expected_input_unbounded,
- expected_input_bounded,
- expected_optimized_unbounded,
- expected_optimized_bounded,
- expected_optimized_bounded_sort_preserve,
- physical_plan,
- source_unbounded,
- prefer_existing_sort
- );
+ let run = ReplaceTest::new(physical_plan)
+ .with_boundedness(boundedness)
+ .with_sort_preference(sort_pref);
+
+ let physical_plan = run.run().await;
+
+ allow_duplicates! {
+ match (boundedness, sort_pref) {
+ (Boundedness::Bounded, SortPreference::MaximizeParallelism) => {
Review Comment:
i changed it from bools because otherwise it'd be hard to understand what
does e.g. `true, false` mean
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]