Skip to content

ARROW-2597: [Plasma] remove UniqueIDHasher#2059

Closed
zhijunfu wants to merge 2 commits intoapache:masterfrom
ant-tech-alliance:remove-UniqueIDHasher
Closed

ARROW-2597: [Plasma] remove UniqueIDHasher#2059
zhijunfu wants to merge 2 commits intoapache:masterfrom
ant-tech-alliance:remove-UniqueIDHasher

Conversation

@zhijunfu
Copy link
Copy Markdown
Contributor

Replace UniqueIDHasher with std::hash so that STL containers with ObjectID doesn't need to specify the compare function. This has already been done for Ray, this change applies it to Plasma.

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 17, 2018

Codecov Report

Merging #2059 into master will decrease coverage by 1.17%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2059      +/-   ##
==========================================
- Coverage   87.44%   86.26%   -1.18%     
==========================================
  Files         189      230      +41     
  Lines       29376    40159   +10783     
==========================================
+ Hits        25687    34643    +8956     
- Misses       3689     5516    +1827
Impacted Files Coverage Δ
cpp/src/plasma/plasma.h 100% <ø> (ø) ⬆️
cpp/src/plasma/eviction_policy.h 100% <ø> (ø) ⬆️
cpp/src/plasma/store.h 100% <ø> (ø) ⬆️
cpp/src/plasma/client.cc 83.54% <ø> (ø) ⬆️
cpp/src/plasma/protocol.h 100% <ø> (ø) ⬆️
cpp/src/plasma/test/serialization_tests.cc 100% <100%> (ø) ⬆️
cpp/src/plasma/common.cc 94.59% <100%> (+0.47%) ⬆️
cpp/src/plasma/common.h 100% <100%> (ø) ⬆️
cpp/src/plasma/store.cc 88.7% <100%> (ø) ⬆️
cpp/src/plasma/protocol.cc 99.41% <100%> (ø) ⬆️
... and 67 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df20683...2498635. Read the comment docs.

Copy link
Copy Markdown
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor question.

};

template <>
struct hash<const ::plasma::UniqueID> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it really necessary to have the two hash<> specializations (const and non-const)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment. The const version is mainly for container declarations like below, without const this would not compile. This kind of usage is rare though:)

std::unordered_map<const UniqueID, int> s;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, I don't think such use makes much sense. See https://stackoverflow.com/questions/17638154/what-is-difference-between-const-and-non-const-key
("map keys are semantically immutable" and also "some implementations re-use map nodes; under those implementations, attempting to use a const key simply won't work")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@zhijunfu I think it makes a lot of sense to remove it for now, if there is a use case in the future, we can always re-add it. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pcmoritz @pitrou sure, will remove const version.

@pcmoritz pcmoritz closed this in f319bca May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants