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

fix(optimizer): fix lookup join and agg distribution derive #6833

Merged
merged 5 commits into from
Dec 12, 2022

Conversation

chenzl25
Copy link
Contributor

@chenzl25 chenzl25 commented Dec 9, 2022

I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.

What's changed and what's your intention?

PLEASE DO NOT LEAVE THIS EMPTY !!!

Please explain IN DETAIL what the changes are in this PR and why they are needed:

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.

Types of user-facing changes

Please keep the types that apply to your changes, and remove those that do not apply.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.

Refer to a related PR or issue link (optional)

@chenzl25 chenzl25 requested a review from st1page December 9, 2022 11:34
@github-actions github-actions bot added the type/fix Bug fix label Dec 9, 2022
@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Merging #6833 (c751355) into main (4a7dc72) will decrease coverage by 0.00%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##             main    #6833      +/-   ##
==========================================
- Coverage   73.22%   73.22%   -0.01%     
==========================================
  Files        1026     1026              
  Lines      164162   164168       +6     
==========================================
+ Hits       120207   120210       +3     
- Misses      43955    43958       +3     
Flag Coverage Δ
rust 73.22% <91.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntend/src/optimizer/plan_node/batch_lookup_join.rs 57.06% <88.88%> (+0.88%) ⬆️
...frontend/src/optimizer/plan_node/batch_hash_agg.rs 66.07% <100.00%> (ø)
...frontend/src/optimizer/plan_node/batch_sort_agg.rs 75.60% <100.00%> (ø)
...rontend/src/optimizer/plan_node/stream_hash_agg.rs 92.53% <100.00%> (-1.50%) ⬇️
src/common/src/types/ordered_float.rs 32.03% <0.00%> (-0.20%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@BowenXiao1999 BowenXiao1999 left a comment

Choose a reason for hiding this comment

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

LGTM

BatchExchange { order: [], dist: Single }
└─BatchHashAgg { group_key: [t2.c, t2.d], aggs: [count(t.a)] }
└─BatchExchange { order: [], dist: HashShard(t2.c, t2.d) }
└─BatchHashAgg { group_key: [t2.c, t2.d, t.a], aggs: [] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Before this pr, we can not derive the group_key here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before this pr, we will miss a exchange here.

@BugenZhao
Copy link
Member

Will #6642 be caused by this? 🤔

- name: test index join distribution derive
sql: |
set rw_batch_enable_lookup_join = true;
set query_mode = distributed;
Copy link
Member

Choose a reason for hiding this comment

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

I guess the batch_plan must be distributed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, our query execution mode by default is local, so we need to set it to distributed.

Copy link
Member

Choose a reason for hiding this comment

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

Seems we always generate distributed plan. For local plan, we use the local_batch_plan field.

let batch_plan = match logical_plan.gen_batch_distributed_plan() {
Ok(batch_plan) => batch_plan,
Err(err) => {
ret.batch_error = Some(err.to_string());
break 'batch;
}
};
// Only generate batch_plan if it is specified in test case
if self.batch_plan.is_some() {
ret.batch_plan = Some(explain_plan(&batch_plan));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. I can remove it in this #6818 PR together.

set rw_batch_enable_lookup_join = true;
set query_mode = distributed;

@mergify mergify bot merged commit ddd90a1 into main Dec 12, 2022
@mergify mergify bot deleted the dylan/fix_lookup_join_and_hash_agg_distribution branch December 12, 2022 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants