Changeset: d3276d8beea9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d3276d8beea9 Added Files: sql/test/BugTracker-2026/Tests/7921-correlated-floor-ratio-bug.test Modified Files: sql/test/BugTracker-2026/Tests/All Branch: Dec2025 Log Message:
Add test for #7921 diffs (80 lines): diff --git a/sql/test/BugTracker-2026/Tests/7921-correlated-floor-ratio-bug.test b/sql/test/BugTracker-2026/Tests/7921-correlated-floor-ratio-bug.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2026/Tests/7921-correlated-floor-ratio-bug.test @@ -0,0 +1,67 @@ +statement ok +CREATE TABLE t_bug11 ( + id INT, + p VARCHAR(32), + od DECIMAL(20, 10), + v INT, + PRIMARY KEY (id), + UNIQUE (p, od) +) + +statement ok rowcount 10 +INSERT INTO t_bug11 VALUES + (10, 'pk_v_06891_2', 695043.6706009629, -764), + (11, 'pk_v_06891_2', 695043.6706009323, 850), + (12, 'pk_v_06891_2', 695043.6706009017, 285), + (13, 'pk_v_06891_2', 695043.6706008711, 424), + (14, 'pk_v_06891_2', 695043.6706008405, 335), + (15, 'pk_v_06891_2', 695043.6706008099, -602), + (16, 'pk_v_06891_2', 695043.6706007793, 747), + (17, 'pk_v_06891_2', 695043.6706007487, -657), + (18, 'pk_v_06891_2', 695043.6706007181, 993), + (19, 'pk_v_06891_2', 695043.6706006875, 747) + +-- original window query +query I nosort +SELECT v +FROM ( + SELECT v, NTILE(5) OVER (PARTITION BY p ORDER BY od ASC) AS rn + FROM t_bug11 +) x +WHERE rn IN (1, 3, 4, 5) +ORDER BY v +---- +-764 +-602 +285 +335 +424 +747 +850 +993 + +-- rewritten window query +-- bucket = FLOOR(count_before / 2) + 1 +query I nosort +SELECT t1.v +FROM t_bug11 AS t1 +WHERE FLOOR(( + SELECT COUNT(*) + FROM t_bug11 AS t2 + WHERE t2.p = t1.p + AND t2.od < t1.od +) / 2) + 1 IN (1, 3, 4, 5) +ORDER BY t1.v +---- +-764 +-602 +285 +335 +424 +747 +850 +993 + +statement ok +DROP TABLE t_bug11 + diff --git a/sql/test/BugTracker-2026/Tests/All b/sql/test/BugTracker-2026/Tests/All --- a/sql/test/BugTracker-2026/Tests/All +++ b/sql/test/BugTracker-2026/Tests/All @@ -105,3 +105,4 @@ KNOWNFAIL?7917-correlated-count-query-bu KNOWNFAIL?7918-subquery-limit-offset-bug KNOWNFAIL?7919-correlated-count-distinct-bug KNOWNFAIL?7920-correlated-top-1-subquery-bug +KNOWNFAIL?7921-correlated-floor-ratio-bug _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
