Skip to content

Conversation

@EmmyMiao87
Copy link
Contributor

Proposed changes

The rewrite rule named CountToSum does not distinguish between Count and Count distinct which causes Count distinct is rewritten as Sum incorrectly.
So this commit modified matching rule.
When the function is Count distinct, the rewrite rule will not take effect.

Fixed #4381

Change-Id: I2b9fbde22c6bc91ba7310e630e29a7e96b909102

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • [] Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have create an issue on (Fix Query with Count distinct matches the incorrect materialized view  #4381), and have described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • [] Any dependent changes have been merged

The rewrite rule named `CountToSum` does not distinguish between `Count` and `Count distinct` which causes `Count distinct` is rewritten as `Sum` incorrectly.
So this commit modified matching rule.
When the function is `Count distinct`, the rewrite rule will not take effect.

Fixed apache#4381

Change-Id: I2b9fbde22c6bc91ba7310e630e29a7e96b909102
@EmmyMiao87 EmmyMiao87 added kind/fix Categorizes issue or PR as related to a bug. area/materialized-view Issues or PRs related to materialized view branch-0.13 PR which need to merge to branch 0.13 labels Aug 18, 2020
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Aug 18, 2020
@morningman morningman merged commit 6bb111b into apache:master Aug 20, 2020
acelyc111 pushed a commit to acelyc111/incubator-doris that referenced this pull request Aug 21, 2020
The rewrite rule named `CountToSum` does not distinguish between `Count` and `Count distinct` which causes `Count distinct` is rewritten as `Sum` incorrectly.
So this commit modified matching rule.
When the function is `Count distinct`, the rewrite rule will not take effect.

Fixed apache#4381
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/materialized-view Issues or PRs related to materialized view branch-0.13 PR which need to merge to branch 0.13 kind/fix Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query with Count distinct matches the incorrect materialized view

2 participants