alamb commented on code in PR #14637: URL: https://github.com/apache/datafusion/pull/14637#discussion_r1966505166
########## datafusion/sqllogictest/test_files/union_by_name.slt: ########## @@ -244,13 +244,15 @@ SELECT x, y FROM t1 UNION BY NAME (SELECT y, z FROM t2 INTERSECT SELECT 2, 2 as 3 3 NULL NULL 2 2 -query III -SELECT x, y FROM t1 UNION ALL BY NAME (SELECT y, z FROM t2 INTERSECT SELECT 2, 2 as two FROM t1 ORDER BY 1) ORDER BY 1; ----- -1 1 NULL -3 3 NULL -3 3 NULL -NULL 2 2 +# TODO: Test regression on a new feature, with the same SanityCheckPlan failures as currently existing for this feature. Review Comment: This doesn't seem right to me -- this shows a regression (a query that was working is now no longer working)? Doesn't that mean that the fix in this PR is likely not correct? ########## datafusion/physical-optimizer/src/enforce_sorting/mod.rs: ########## @@ -138,27 +138,25 @@ fn is_coalesce_to_remove( node: &Arc<dyn ExecutionPlan>, parent: &Arc<dyn ExecutionPlan>, ) -> bool { - node.as_any() - .downcast_ref::<CoalescePartitionsExec>() + node.as_any().downcast_ref::<CoalescePartitionsExec>() .map(|_coalesce| { // TODO(wiedld): find a more generalized approach that does not rely on // pattern matching the structure of the DAG // Note that the `Partitioning::satisfy()` (parent vs. coalesce.child) cannot be used for cases of: // * Repartition -> Coalesce -> Repartition + // * Coalesce -> AggregateExec(input=hash-partitioned) - let parent_req_single_partition = matches!( - parent.required_input_distribution()[0], - Distribution::SinglePartition - ); + let parent_req_single_partition = matches!(parent.required_input_distribution()[0], Distribution::SinglePartition) + // handle aggregates with input=hashPartitioning with a single output partition + || (is_aggregate(parent) && parent.properties().output_partitioning().partition_count() <= 1); Review Comment: sorry I don't understand what this is asking -- if it is still relevant can you perhaps clarify what refactor you are referring to? -- 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