-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fdef93
commit 597d174
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
tests/queries/0_stateless/03102_prefer_column_name_to_alias.reference
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,2 @@ | ||
5 | ||
6 |
30 changes: 30 additions & 0 deletions
30
tests/queries/0_stateless/03102_prefer_column_name_to_alias.sql
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,30 @@ | ||
-- https://github.com/ClickHouse/ClickHouse/issues/54954 | ||
|
||
DROP TABLE IF EXISTS loans; | ||
|
||
CREATE TABLE loans (loan_number int, security_id text) ENGINE=Memory; | ||
|
||
SET allow_experimental_analyzer=1; | ||
|
||
INSERT INTO loans VALUES (1, 'AAA'); | ||
INSERT INTO loans VALUES (1, 'AAA'); | ||
INSERT INTO loans VALUES (1, 'AAA'); | ||
INSERT INTO loans VALUES (1, 'AAA'); | ||
INSERT INTO loans VALUES (1, 'AAA'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
INSERT INTO loans VALUES (1, 'BBB'); | ||
|
||
|
||
with block_0 as ( | ||
select * from loans | ||
), | ||
block_1 as ( | ||
select sum(loan_number) as loan_number from block_0 group by security_id | ||
) | ||
select loan_number from block_1 where loan_number > 3 settings prefer_column_name_to_alias = 1; | ||
|
||
DROP TABLE IF EXISTS loans; |