Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29538 from ClickHouse/backport/21.8/29475
Backport #29475 to 21.8: Remove filter column from HAVING when it is not needed.
- Loading branch information
Showing
10 changed files
with
121 additions
and
30 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
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
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
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
drop table if exists test; | ||
|
||
-- #29010 | ||
CREATE TABLE test | ||
( | ||
d DateTime, | ||
a String, | ||
b UInt64 | ||
) | ||
ENGINE = MergeTree | ||
PARTITION BY toDate(d) | ||
ORDER BY d; | ||
|
||
SELECT * | ||
FROM ( | ||
SELECT | ||
a, | ||
max((d, b)).2 AS value | ||
FROM test | ||
GROUP BY rollup(a) | ||
) | ||
WHERE a <> ''; | ||
|
||
-- the same query, but after syntax optimization | ||
SELECT | ||
a, | ||
value | ||
FROM | ||
( | ||
SELECT | ||
a, | ||
max((d, b)).2 AS value | ||
FROM test | ||
GROUP BY a | ||
WITH ROLLUP | ||
HAVING a != '' | ||
) | ||
WHERE a != ''; | ||
|
||
drop table if exists test; |