Skip to content

Support countdistinct pushdown#1457

Merged
tisonkun merged 18 commits into
pingcap:masterfrom
tisonkun:pushdown-distinct-aggregation
Mar 10, 2021
Merged

Support countdistinct pushdown#1457
tisonkun merged 18 commits into
pingcap:masterfrom
tisonkun:pushdown-distinct-aggregation

Conversation

@tisonkun
Copy link
Copy Markdown
Contributor

@tisonkun tisonkun commented Feb 23, 2021

What problem does this PR solve?

Issue Number: ref #1428

co pingcap/tidb#22867

Problem Summary:

Support count distinct pushdown.

What is changed and how it works?

Proposal: Pushing down DISTINCT AGG in MPP

What's Changed:

Update contrib/tipb to respect Expr.has_distinct. When the flag is true, append agg_func_name with Distinct suffix.

Also replace countdistinct with implementation in settings, which is the same logic.

Workaround -Null Combinator to bypass count distinct with null value. An elegant impl could follow with ClickHouse/ClickHouse#11661

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)

Side effects

N/A

Release note

  • Support push down count distinct in MPP mode.

@ti-srebot ti-srebot added the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Feb 23, 2021
@tisonkun tisonkun changed the title append -Distinct if tipb::Expr has_distinct present [WIP] append -Distinct if tipb::Expr has_distinct present Feb 23, 2021
@tisonkun tisonkun changed the title [WIP] append -Distinct if tipb::Expr has_distinct present Support countdistinct pushdown Feb 24, 2021
@tisonkun
Copy link
Copy Markdown
Contributor Author

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

/rebuild

@tisonkun
Copy link
Copy Markdown
Contributor Author

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

/rebuild

@tisonkun
Copy link
Copy Markdown
Contributor Author

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

tisonkun commented Mar 9, 2021

@hanfei1991 @windtalker PTAL

@hanfei1991
Copy link
Copy Markdown
Member

A little question: What does the kvproto change for?

@tisonkun
Copy link
Copy Markdown
Contributor Author

tisonkun commented Mar 9, 2021

A little question: What does the kvproto change for?

We don't have effective change for kvproto, maybe polluted casually, reverting...

@hanfei1991
Copy link
Copy Markdown
Member

/LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 9, 2021
@tisonkun
Copy link
Copy Markdown
Contributor Author

tisonkun commented Mar 9, 2021

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

tisonkun commented Mar 9, 2021

/run-all-tests

Comment thread dbms/src/Flash/Coprocessor/DAGUtils.cpp Outdated
Comment thread dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp Outdated
@tisonkun tisonkun self-assigned this Mar 10, 2021
Comment thread dbms/src/Flash/Coprocessor/DAGUtils.cpp Outdated
@tisonkun
Copy link
Copy Markdown
Contributor Author

/run-all-tests

@tisonkun
Copy link
Copy Markdown
Contributor Author

@windtalker please take a look.

Copy link
Copy Markdown
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Mar 10, 2021
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Mar 10, 2021
@tisonkun tisonkun merged commit b1be972 into pingcap:master Mar 10, 2021
@tisonkun
Copy link
Copy Markdown
Contributor Author

Thanks for your reviews!

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

Labels

first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants