Skip to content

[Colocate plan][Step2] Colocate aggregation covers more situations#5555

Merged
morningman merged 3 commits intoapache:masterfrom
EmmyMiao87:colocate_agg
May 22, 2021
Merged

[Colocate plan][Step2] Colocate aggregation covers more situations#5555
morningman merged 3 commits intoapache:masterfrom
EmmyMiao87:colocate_agg

Conversation

@EmmyMiao87
Copy link
Contributor

@EmmyMiao87 EmmyMiao87 commented Mar 22, 2021

Proposed changes

[Colocate plan][Step2] Colocate aggregation covers more situations

The old colocate aggregation can only cover the case where the child is scan.
In fact, as long as the child's data distribution meets the requirements,
  no matter what the plan node on the child node is, a colocate aggregation can be performed.

This PR also fixes the correct data partition attribute of fragment.
The data partition of fragment which contains scan node is Hash Partition rather than Random.
This modification is mainly to determine the possibility of colocate
  through the correct distribution of child fragments.

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 created an issue on (Fix Colocate plan #5589) and 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 these changes need document changes, I have updated the document
  • Any dependent changes have been merged

Further comments

unit test is coming.

@EmmyMiao87 EmmyMiao87 added kind/improvement area/planner Issues or PRs related to the query planner area/colocated Issues or PRs related to colocated tables labels Mar 22, 2021
@EmmyMiao87 EmmyMiao87 self-assigned this Mar 22, 2021
@EmmyMiao87 EmmyMiao87 force-pushed the colocate_agg branch 5 times, most recently from 8144375 to 7486619 Compare March 25, 2021 10:39
The old colocate join can only cover the case where the child is hash or scan.
In fact, as long as the child's data distribution meets the requirements,
  no matter what the plan node on the child node is, a colocate join can be performed.
The old colocate aggregation can only cover the case where the child is scan.
In fact, as long as the child's data distribution meets the requirements,
  no matter what the plan node on the child node is, a colocate aggregation can be performed.

This PR also fixes the correct data partition attribute of fragment.
The data partition of fragment which contains scan node is Hash Partition rather than Random.
This modification is mainly to determine the possibility of colocate
  through the correct distribution of child fragments.
* 1. Session variables disable_colocate_plan = false
=======
* 1. Session variables disable_colocate_plan = true
>>>>>>> 26f4e1fa8 ([Colocate plan][Step1] Colocate join covers more situations)
Copy link
Contributor

Choose a reason for hiding this comment

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

Conflict?


/**
* Colocate Agg can be performed when the following 2 conditions are met at the same time.
* 1. Session variables disable_colocate_plan = true
Copy link
Contributor

Choose a reason for hiding this comment

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

disable_colocate_plan=false?

private boolean canColocateAgg(AggregateInfo aggregateInfo, List<DataPartition> childFragmentDataPartition) {
// Condition1
if (ConnectContext.get().getSessionVariable().isDisableColocatePlan()) {
LOG.info("Agg node is not colocate in:" + ConnectContext.get().getQueryDetail().getQueryId()
Copy link
Contributor

Choose a reason for hiding this comment

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

debug level

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 May 19, 2021
@morningman morningman merged commit 5a06dba into apache:master May 22, 2021
stdpain pushed a commit to stdpain/incubator-doris that referenced this pull request Jul 8, 2021
…pache#5555)

The old colocate aggregation can only cover the case where the child is scan.
In fact, as long as the child's data distribution meets the requirements,
no matter what the plan node on the child node is, a colocate aggregation can be performed.

This PR also fixes the correct data partition attribute of fragment.
The data partition of fragment which contains scan node is Hash Partition rather than Random.
This modification is mainly to determine the possibility of colocate
through the correct distribution of child fragments.

Change-Id: I6ac76aa331dfa5966a4a84143c9983bc1d55c808
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/colocated Issues or PRs related to colocated tables area/planner Issues or PRs related to the query planner kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Colocate plan

2 participants