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(array): inconsistent hash behavior of Datum and Array::Item #3458

Merged
merged 3 commits into from
Jun 25, 2022

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Jun 24, 2022

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

What's changed and what's your intention?

As title. This is a fix for common types except for array and struct. Check #3457 for more details.

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)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@github-actions github-actions bot added the type/fix Bug fix label Jun 24, 2022
@BugenZhao BugenZhao requested a review from st1page June 24, 2022 10:37
@codecov
Copy link

codecov bot commented Jun 24, 2022

Codecov Report

Merging #3458 (6b8c527) into main (76b609b) will increase coverage by 0.00%.
The diff coverage is 73.68%.

@@           Coverage Diff           @@
##             main    #3458   +/-   ##
=======================================
  Coverage   74.30%   74.31%           
=======================================
  Files         769      769           
  Lines      106775   106773    -2     
=======================================
+ Hits        79338    79346    +8     
+ Misses      27437    27427   -10     
Flag Coverage Δ
rust 74.31% <73.68%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/common/src/array/mod.rs 73.02% <ø> (ø)
src/storage/src/table/cell_based_table.rs 71.67% <0.00%> (+0.61%) ⬆️
src/common/src/array/data_chunk_iter.rs 79.72% <25.00%> (+1.58%) ⬆️
src/common/src/types/mod.rs 68.00% <92.85%> (+0.25%) ⬆️
src/meta/src/manager/id.rs 95.50% <0.00%> (-0.57%) ⬇️
src/frontend/src/expr/utils.rs 99.24% <0.00%> (+0.50%) ⬆️

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

Some(datum) => datum.hash(&mut hasher),
None => bail!("index {} out of row bound", idx),
}
hash_datum(&self.0[*idx], &mut hasher);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if idx is greater than the length of the row? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Indexing with [..] will panic if out of bound.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we panic here? Or should we return an error?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think panicking here is okay since the indices are inferred or specified by some other components most of the time. If this fails, there must be a bug in our system and we're unable to recover it.

@BugenZhao BugenZhao added the mergify/can-merge Indicates that the PR can be added to the merge queue label Jun 25, 2022
@mergify mergify bot merged commit c0e02d7 into main Jun 25, 2022
@mergify mergify bot deleted the bz/fix-datum-hash branch June 25, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergify/can-merge Indicates that the PR can be added to the merge queue type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants