Skip to content

Commit

Permalink
Closes: #54954
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitamikhaylov committed Apr 10, 2024
1 parent 4fdef93 commit 597d174
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
5
6
30 changes: 30 additions & 0 deletions tests/queries/0_stateless/03102_prefer_column_name_to_alias.sql
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;

0 comments on commit 597d174

Please sign in to comment.