alamb commented on code in PR #11678:
URL: https://github.com/apache/datafusion/pull/11678#discussion_r1698854048
##########
datafusion/core/src/physical_optimizer/enforce_sorting.rs:
##########
@@ -2346,4 +2347,67 @@ mod tests {
assert_optimized!(expected_input, expected_no_change, physical_plan,
true);
Ok(())
}
+
+ #[tokio::test]
+ async fn test_push_with_required_input_ordering_prohibited() -> Result<()>
{
+ // SortExec: expr=[b] <-- can't push this down
+ // RequiredInputOrder expr=[a] <-- this requires input sorted by a,
and preserves the input order
+ // SortExec: expr=[a]
+ // MemoryExec
+ let schema = create_test_schema3()?;
+ let sort_exprs_a = vec![sort_expr("a", &schema)];
+ let sort_exprs_b = vec![sort_expr("b", &schema)];
+ let plan = memory_exec(&schema);
+ let plan = sort_exec(sort_exprs_a.clone(), plan);
+ let plan = RequirementsTestExec::new(plan)
+ .with_required_input_ordering(sort_exprs_a)
+ .with_maintains_input_order(true)
+ .into_arc();
+ let plan = sort_exec(sort_exprs_b, plan);
+
+ let expected_input = [
+ "SortExec: expr=[b@1 ASC], preserve_partitioning=[false]",
Review Comment:
This test fails on main -- specifically the SortExec is pushed below the
RequiredInputOrderingExec so its input is sorted on `b` which violates its
input requirements that it is sorted on `a`
--
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]