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

Pre-aggregate repeated case aggregations #12548

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

sopel39
Copy link
Member

@sopel39 sopel39 commented May 25, 2022

Rule that transforms:

  • Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
    • Project:
      aggr1 = CASE WHEN col=1 THEN expr ELSE 0
      aggr2 = CASE WHEN col=2 THEN expr ELSE 0
      ...
      aggrN = CASE WHEN col=N THEN expr ELSE 0
      • source

into:

  • Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
    • Project:
      aggr1 = CASE WHEN col=1 THEN pre_aggregate ELSE 0
      aggr2 = CASE WHEN col=2 THEN pre_aggregate ELSE 0
      ..
      aggrN = CASE WHEN col=N THEN pre_aggregate ELSE 0
      • Aggregation[key, col]: pre_aggregate = sum(expr)
        • source

Description

Is this change a fix, improvement, new feature, refactoring, or other?

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

How would you describe this change to a non-technical end user or system administrator?

Related issues, pull requests, and links

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
( ) Release notes entries required with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@sopel39 sopel39 requested a review from findepi May 25, 2022 15:49
@cla-bot cla-bot bot added the cla-signed label May 25, 2022
@sopel39 sopel39 marked this pull request as ready for review May 25, 2022 15:50
@findepi findepi requested a review from kasiafi May 26, 2022 07:33
@sopel39 sopel39 force-pushed the ks/pre-aggregate branch from ccfe9c3 to 6516b41 Compare May 26, 2022 12:31
@sopel39 sopel39 requested a review from findepi May 26, 2022 12:31
@findepi findepi requested review from kasiafi and martint and removed request for kasiafi June 7, 2022 15:49
@sopel39 sopel39 requested a review from kasiafi June 23, 2022 11:33
Copy link
Member

@kasiafi kasiafi left a comment

Choose a reason for hiding this comment

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

LGTM

Rule that transforms:
- Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
  - Project:
       aggr1 = CASE WHEN col=1 THEN expr ELSE 0
       aggr2 = CASE WHEN col=2 THEN expr ELSE 0
       ...
       aggrN = CASE WHEN col=2 THEN expr ELSE 0
     - source

 into:

- Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
   - Project:
       aggr1 = CASE WHEN col=1 THEN pre_aggregate ELSE 0
       aggr2 = CASE WHEN col=2 THEN pre_aggregate ELSE 0
       ..
       aggrN = CASE WHEN col=2 THEN pre_aggregate ELSE 0
     - Aggregation[key, col]: pre_aggregate = sum(expr)
       - source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants