-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: fix invalid transformation in SplitLimitedSelectIntoUnionSelects
This commit removes some untested logic in `SplitLimitedSelectIntoUnionSelects` that created invalid expression transformations. With this logic, this rule could construct an unordered limit below the `UnionAll` which is incorrect. The bug could cause incorrect query results. Fixes #88993 Release note (bug fix): A bug has been fixed that could cause incorrect results in rare cases. The bug could only present if the following conditions were true: 1. A query with `ORDER BY` and `LIMIT` was executed. 2. The table containing the `ORDER BY` columns had an index containing those columns. 3. The index in (2) contained a prefix of columns held to a fixed number of values by the query filter (e.g., `WHERE a IN (1, 3)`), a `CHECK` constraint (e.g., `CHECK (a IN (1, 3))`), inferred by a computed column expression (e.g. `WHERE a IN (1, 3)` and a column `b INT AS (a + 10) STORED`), or inferred by a `PARTITION BY` clause (e.g. `INDEX (a, ...) PARTITION BY LIST (a) (PARTITION p VALUES ((1), (3)))`). This bug was present since version 22.1.0.
- Loading branch information
Showing
5 changed files
with
156 additions
and
164 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -317,3 +317,4 @@ select | |
│ └── [/'foo'/e'bar\x00'/5 - ] | ||
└── filters | ||
└── c = 5 | ||
|
This file contains 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 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 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
Oops, something went wrong.