-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-40698 ROLLUP query returns incorrect result with empty result set #5542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jaeheonshim
wants to merge
8
commits into
MariaDB:10.11
Choose a base branch
from
jaeheonshim:MDEV-40698
base: 10.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c7a531
Add failing tests to olap.test
jaeheonshim 540ea09
Make the approprate changes to send_row_on_empty_set and empty_result
jaeheonshim 494b5f8
Correctly handle both empty-set send cases in end_send_group and end_…
jaeheonshim a2ebe59
Commit new corrected test cases
jaeheonshim 2addac9
Add runtime-evaluated WHERE cases to olap tests
jaeheonshim 59656d7
Move tests into separate file
jaeheonshim b1d9ad7
Add distinct case
jaeheonshim f83223d
Fix incorrect prior tests
jaeheonshim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # | ||
| # MDEV-40698: ROLLUP query returns incorrect result with empty result set | ||
| # | ||
| CREATE TABLE t0(a INT, b INT, c INT); | ||
| SELECT *, COUNT(0) FROM t0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT *, COUNT(0) FROM t0 WHERE 1=0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT *, COUNT(0), ROW_NUMBER() OVER () FROM t0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) ROW_NUMBER() OVER () | ||
| NULL NULL NULL 0 1 | ||
| INSERT INTO t0 VALUES (0, 0, 0); | ||
| INSERT INTO t0 VALUES (0, 0, 0); | ||
| SELECT *, COUNT(0) FROM t0 WHERE a > 0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT EXISTS (SELECT t0.a FROM t0 x WHERE 1=0 GROUP BY x.a WITH ROLLUP) AS e | ||
| FROM t0; | ||
| e | ||
| 1 | ||
| 1 | ||
| SELECT DISTINCT a FROM t0 GROUP BY a, b WITH ROLLUP; | ||
| a | ||
| 0 | ||
| NULL | ||
| CREATE TABLE t1 (a INT, b INT, c INT) ENGINE=InnoDB; | ||
| SELECT *, COUNT(0) FROM t1 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT *, COUNT(0) FROM t1 WHERE 1=0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT *, COUNT(0), ROW_NUMBER() OVER () FROM t1 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) ROW_NUMBER() OVER () | ||
| NULL NULL NULL 0 1 | ||
| INSERT INTO t1 VALUES (0, 0, 0); | ||
| INSERT INTO t1 VALUES (0, 0, 0); | ||
| SELECT *, COUNT(0) FROM t1 WHERE a > 0 GROUP BY a, b, c WITH ROLLUP; | ||
| a b c COUNT(0) | ||
| NULL NULL NULL 0 | ||
| SELECT EXISTS (SELECT t1.a FROM t1 x WHERE 1=0 GROUP BY x.a WITH ROLLUP) AS e | ||
| FROM t1; | ||
| e | ||
| 1 | ||
| 1 | ||
| SELECT DISTINCT a FROM t1 GROUP BY a, b WITH ROLLUP; | ||
| a | ||
| 0 | ||
| NULL | ||
| DROP TABLE t0, t1; | ||
| # | ||
| # End of 10.11 tests | ||
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --source include/have_innodb.inc | ||
|
|
||
| --echo # | ||
| --echo # MDEV-40698: ROLLUP query returns incorrect result with empty result set | ||
| --echo # | ||
|
|
||
| CREATE TABLE t0(a INT, b INT, c INT); | ||
| SELECT *, COUNT(0) FROM t0 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT *, COUNT(0) FROM t0 WHERE 1=0 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT *, COUNT(0), ROW_NUMBER() OVER () FROM t0 GROUP BY a, b, c WITH ROLLUP; | ||
| INSERT INTO t0 VALUES (0, 0, 0); | ||
| INSERT INTO t0 VALUES (0, 0, 0); | ||
| SELECT *, COUNT(0) FROM t0 WHERE a > 0 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT EXISTS (SELECT t0.a FROM t0 x WHERE 1=0 GROUP BY x.a WITH ROLLUP) AS e | ||
| FROM t0; | ||
| SELECT DISTINCT a FROM t0 GROUP BY a, b WITH ROLLUP; | ||
|
|
||
| CREATE TABLE t1 (a INT, b INT, c INT) ENGINE=InnoDB; | ||
| SELECT *, COUNT(0) FROM t1 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT *, COUNT(0) FROM t1 WHERE 1=0 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT *, COUNT(0), ROW_NUMBER() OVER () FROM t1 GROUP BY a, b, c WITH ROLLUP; | ||
| INSERT INTO t1 VALUES (0, 0, 0); | ||
| INSERT INTO t1 VALUES (0, 0, 0); | ||
| SELECT *, COUNT(0) FROM t1 WHERE a > 0 GROUP BY a, b, c WITH ROLLUP; | ||
| SELECT EXISTS (SELECT t1.a FROM t1 x WHERE 1=0 GROUP BY x.a WITH ROLLUP) AS e | ||
| FROM t1; | ||
| SELECT DISTINCT a FROM t1 GROUP BY a, b WITH ROLLUP; | ||
|
|
||
| DROP TABLE t0, t1; | ||
|
|
||
| --echo # | ||
| --echo # End of 10.11 tests | ||
| --echo # | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.