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

feat: Add DecodedVector::sharedBase() #12249

Closed
wants to merge 1 commit into from

Conversation

Yuhta
Copy link
Contributor

@Yuhta Yuhta commented Feb 3, 2025

Summary: Sometimes we need to take shared ownership of the base value vector of a dictionary. The current DecodedVector only keeps reference to a raw pointer so there is no way to get hold of the shared_ptr. We add DecodedVector::sharedBase() and overload of DecodedVector::decode to take shared_ptr so that we can get the shared ownership.

Differential Revision: D69081492

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69081492

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Feb 3, 2025
Copy link

netlify bot commented Feb 3, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 226cee6
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67a3bacf56cf590008f6f8ac

velox/vector/DecodedVector.cpp Outdated Show resolved Hide resolved
velox/vector/DecodedVector.h Outdated Show resolved Hide resolved
Yuhta added a commit to Yuhta/velox that referenced this pull request Feb 4, 2025
Summary:

Sometimes we need to take shared ownership of the base value vector of a dictionary.  The current `DecodedVector` only keeps reference to a raw pointer so there is no way to get hold of the `shared_ptr`.  We add `DecodedVector::sharedBase()` and overload of `DecodedVector::decode` to take `shared_ptr` so that we can get the shared ownership.

Differential Revision: D69081492
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69081492

Yuhta added a commit to Yuhta/velox that referenced this pull request Feb 4, 2025
Summary:

Sometimes we need to take shared ownership of the base value vector of a dictionary.  The current `DecodedVector` only keeps reference to a raw pointer so there is no way to get hold of the `shared_ptr`.  We add `DecodedVector::sharedBase()` and overload of `DecodedVector::decode` to take `shared_ptr` so that we can get the shared ownership.

Differential Revision: D69081492
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69081492

vector_size_t size) const {
VELOX_CHECK(!isIdentityMapping_);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we plan to use dictionaryWrapping() when these conditions are not met?

Edit: Just noticed you added a test for these case, curious why we would want to use this API for these cases as it would end up creating inefficient dictionaries. Is it because we plan to add nulls on top of that?

Also, can you update the method comment to remove the part about Requires /// isIdentityMapping() == false and isConstantMapping() == false. if we plan to keep this?

Copy link
Contributor Author

@Yuhta Yuhta Feb 5, 2025

Choose a reason for hiding this comment

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

I added these to support merging DICT + FLAT, DICT + CONST, CONST + CONST. It might not be the most efficient way to do this; I will revisit this if we need to avoid allocating the indices and nulls too early, but for now it is working for the internal use case. As far as this method is concerned, it does not hurt to enable these as there are very clear flags we can check if we want to forbid them on call site.

Summary:

Sometimes we need to take shared ownership of the base value vector of a dictionary.  The current `DecodedVector` only keeps reference to a raw pointer so there is no way to get hold of the `shared_ptr`.  We add `DecodedVector::sharedBase()` and overload of `DecodedVector::decode` to take `shared_ptr` so that we can get the shared ownership.

Reviewed By: bikramSingh91

Differential Revision: D69081492
Yuhta added a commit to Yuhta/velox that referenced this pull request Feb 5, 2025
Summary:

Sometimes we need to take shared ownership of the base value vector of a dictionary.  The current `DecodedVector` only keeps reference to a raw pointer so there is no way to get hold of the `shared_ptr`.  We add `DecodedVector::sharedBase()` and overload of `DecodedVector::decode` to take `shared_ptr` so that we can get the shared ownership.

Reviewed By: bikramSingh91

Differential Revision: D69081492
@Yuhta Yuhta force-pushed the export-D69081492 branch 2 times, most recently from be0b593 to 226cee6 Compare February 5, 2025 19:23
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69081492

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69081492

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 8e6e2cc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants