Skip to content

Normalize count() variants#20175

Merged
vdimir merged 3 commits intoClickHouse:masterfrom
amosbird:countrewrite
Feb 11, 2021
Merged

Normalize count() variants#20175
vdimir merged 3 commits intoClickHouse:masterfrom
amosbird:countrewrite

Conversation

@amosbird
Copy link
Copy Markdown
Collaborator

@amosbird amosbird commented Feb 7, 2021

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Improvement

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

Normalize count(constant), sum(1) to count(). This is needed for projection query routing.

Detailed description / Documentation draft:

.

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Feb 7, 2021
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we don't want to perform transformations unconditionally?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add count(null) to ensure that it is not optimized.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely.

@vdimir vdimir self-assigned this Feb 8, 2021
@vdimir
Copy link
Copy Markdown
Member

vdimir commented Feb 8, 2021

Build error:

2021-02-07 08:25:47 ../src/Interpreters/RewriteCountVariantsVisitor.h:13:17: error: function 'DB::RewriteCountVariantsVisitor::visit' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name,-warnings-as-errors]
2021-02-07 08:25:47     static void visit(ASTPtr & ast);
2021-02-07 08:25:47                 ^
2021-02-07 08:25:47 /build/obj-x86_64-linux-gnu/../src/Interpreters/RewriteCountVariantsVisitor.cpp:12:35: note: the definition seen here
2021-02-07 08:25:47 void RewriteCountVariantsVisitor::visit(ASTPtr & node)
2021-02-07 08:25:47                                   ^
2021-02-07 08:25:47 /build/obj-x86_64-linux-gnu/../src/Interpreters/RewriteCountVariantsVisitor.h:13:17: note: differing parameters are named here: ('ast'), in definition: ('node')
2021-02-07 08:25:47     static void visit(ASTPtr & ast);

https://clickhouse-builds.s3.yandex.net/20175/e14b8df2cf6da6f0aae5fb9821db9a84705ac0f8/clickhouse_special_build_check/report.html#fail1

@amosbird
Copy link
Copy Markdown
Collaborator Author

Test failure looks unrelated.

@abyss7
Copy link
Copy Markdown
Contributor

abyss7 commented Feb 11, 2021

Test failure looks unrelated.

It's related - it breaks master.

@amosbird
Copy link
Copy Markdown
Collaborator Author

Test failure looks unrelated.

It's related - it breaks master.

Oops. The test failure looks quite obscure w.r.t to parser changes. I still don't see how it's related.

@abyss7
Copy link
Copy Markdown
Contributor

abyss7 commented Feb 15, 2021

Test failure looks unrelated.

It's related - it breaks master.

Oops. The test failure looks quite obscure w.r.t to parser changes. I still don't see how it's related.

With the new parser the IFunction::arguments may be nullptr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants