Skip to content
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

Fixed Unknown identifier (aggregate-function) exception which appears when a user tries to calculate WINDOW ORDER BY/PARTITION BY expressions over aggregate functions #39762

Merged
merged 5 commits into from
Sep 1, 2022

Conversation

quickhouse
Copy link
Contributor

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fixed Unknown identifier (aggregate-function) exception which appears when a user tries to calculate WINDOW ORDER BY/PARTITION BY expressions over aggregate functions:

CREATE TABLE default.tenk1
(
    `unique1` Int32,
    `unique2` Int32,
    `ten` Int32
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192;
SELECT
    ten,
    sum(unique1) + sum(unique2) AS res,
    rank() OVER (ORDER BY sum(unique1) + sum(unique2) ASC) AS rank
FROM _complex
GROUP BY ten
ORDER BY ten ASC;

which gives:

Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Unknown identifier: sum(unique1); there are columns: unique1, unique2, ten: While processing sum(unique1) + sum(unique2) ASC. (UNKNOWN_IDENTIFIER)

The bug was introduced in #34632 .

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

…`ExpressionAnalyzer`, shall be `aggregated_columns`.
@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Jul 31, 2022
@novikd novikd self-assigned this Jul 31, 2022
@novikd novikd added the can be tested Allows running workflows for external contributors label Jul 31, 2022
Enmk added a commit to Altinity/ClickHouse that referenced this pull request Aug 11, 2022
…tion

Fixed `Unknown identifier (aggregate-function)` exception which appears when a user tries to calculate WINDOW ORDER BY/PARTITION BY expressions over aggregate functions — backport of ClickHouse#39762
@quickhouse
Copy link
Contributor Author

@novikd What shall be next steps?

@novikd novikd merged commit ddadb36 into ClickHouse:master Sep 1, 2022
@Enmk Enmk mentioned this pull request Sep 12, 2022
4 tasks
@UnamedRus
Copy link
Contributor

Can we have backport of this to 22.8?

@nvm1
Copy link

nvm1 commented Oct 26, 2022

Hi there,

Is there any chance that this fix will be backported to 22.8?

robot-clickhouse pushed a commit that referenced this pull request Oct 26, 2022
…n)` exception which appears when a user tries to calculate WINDOW ORDER BY/PARTITION BY expressions over aggregate functions
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 26, 2022
novikd added a commit that referenced this pull request Oct 30, 2022
Backport #39762 to 22.8: Fixed `Unknown identifier (aggregate-function)` exception which appears when a user tries to calculate WINDOW ORDER BY/PARTITION BY expressions over aggregate functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can be tested Allows running workflows for external contributors pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants