You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/10/09 17:27:15 UTC
[PR] test: Add regression test for limit / sort [datafusion]
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] test: Add regression test for limit / sort [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #26161:
URL: https://github.com/apache/datafusion/pull/26161#discussion_r4232785672
##########
datafusion/sqllogictest/test_files/limit.slt:
##########
@@ -1094,3 +1094,30 @@ physical_plan
statement ok
DROP TABLE t22489;
+
+
+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
Review Comment:
note this test fails on main
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] test: Add regression test for limit / sort [datafusion]
Posted by "alamb (via GitHub) via github" <gi...@datafusion.apache.org>.
alamb closed pull request #26161: test: Add regression test for limit / sort
URL: https://github.com/apache/datafusion/pull/26161
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org