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(agg): fix the wrong passing of dist key. #3437

Merged
merged 2 commits into from
Jun 24, 2022
Merged

Conversation

BowenXiao1999
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 commented Jun 23, 2022

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

What's changed and what's your intention?

Otherwise the vnode will not be computed for hash_agg. The group key will always be the first [0, group_key.len()) of insert row.

Checklist

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

Refer to a related PR or issue link (optional)

@github-actions github-actions bot added the type/fix Bug fix label Jun 23, 2022
@codecov
Copy link

codecov bot commented Jun 23, 2022

Codecov Report

Merging #3437 (eba6c34) into main (d1d5523) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3437      +/-   ##
==========================================
- Coverage   74.25%   74.25%   -0.01%     
==========================================
  Files         768      768              
  Lines      106499   106502       +3     
==========================================
+ Hits        79086    79088       +2     
- Misses      27413    27414       +1     
Flag Coverage Δ
rust 74.25% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/stream/src/executor/aggregation/mod.rs 93.18% <100.00%> (+0.07%) ⬆️
src/meta/src/hummock/compaction_group/manager.rs 90.48% <0.00%> (-0.58%) ⬇️
src/common/src/types/ordered_float.rs 24.70% <0.00%> (-0.20%) ⬇️
src/frontend/src/expr/utils.rs 99.24% <0.00%> (+0.25%) ⬆️
src/meta/src/manager/id.rs 96.62% <0.00%> (+0.56%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@@ -410,6 +410,7 @@ pub fn generate_state_table<S: StateStore>(
let table_desc = generate_column_descs(agg_call, group_keys, pk_indices, agg_schema, input_ref);
// Always leave 1 space for agg call value.
let relational_pk_len = table_desc.len() - 1;
let dist_keys: Vec<usize> = (0..group_keys.len()).collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC here dist_keys stands for the dist key indices in pk. But in fact we should pass dist key indices in value to state table? cc. @BugenZhao

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, I remembered that when compute vnode we are using indices on pk?

Copy link
Member

Choose a reason for hiding this comment

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

But in fact we should pass dist key indices in value to state table?

Yes. However, it seems they are the same in this case?

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, I remembered that when compute vnode we are using indices on pk?

We switch to indices on all columns to reduce the complexity of the interfaces. The "indices based on pk" will be inferred in the cell-based table.

https://github.com/singularity-data/risingwave/blob/4cf6a163d4767f34e761ee6172ef93f039161cb9/src/storage/src/table/cell_based_table.rs#L84-L92

@BugenZhao BugenZhao enabled auto-merge (squash) June 24, 2022 06:38
@BugenZhao BugenZhao merged commit 4a0f073 into main Jun 24, 2022
@BugenZhao BugenZhao deleted the bw/fix-dist-key branch June 24, 2022 06:51
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.

None yet

3 participants