alamb opened a new pull request, #26161: URL: https://github.com/apache/datafusion/pull/26161
## Which issue does this PR close? - Follow on to https://github.com/apache/datafusion/pull/25408 ## Rationale for this change @jayzhan211 suggests - https://github.com/apache/datafusion/pull/25408#discussion_r4156325151 > This PR also fixes a wrong-result bug on main: with multiple partitions, an OFFSET-only subquery over `ORDER BY b` followed by `ORDER BY b, a` returns `1, 21, 4, 24, …` on main, because the `[b, a]` sort is pushed under `SortPreservingMergeExec: [b]`. Please add a result check so this doesn't regress: > > ```sql > statement ok > set datafusion.execution.target_partitions = 4; > > statement ok > CREATE TABLE src (a INT, b INT) AS VALUES (1, 3), (2, 1), (3, 2), (4, 3), (5, 1), (6, 2), (7, 3), (8, 1); > > statement ok > CREATE TABLE t AS SELECT a, b FROM src UNION ALL SELECT a + 10, b FROM src > UNION ALL SELECT a + 20, b FROM src UNION ALL SELECT a + 30, b FROM src; > > query II > SELECT * FROM (SELECT a, b FROM t ORDER BY b OFFSET 20) ORDER BY b, a; > ---- > 1 3 > 4 3 > 7 3 > 11 3 > 14 3 > 17 3 > 21 3 > 24 3 > 27 3 > 31 3 > 34 3 > 37 3 > ``` ## What changes are included in this PR? Add this test ## What is the testing strategy for this PR? ## Are there any user-facing changes? Only tests <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please add the `api change` label. --> -- 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]
