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: FixedSizeBinaryArray::value_data return reference #4821

Merged
merged 2 commits into from
Sep 18, 2023

Conversation

wjones127
Copy link
Member

@wjones127 wjones127 commented Sep 15, 2023

Which issue does this PR close?

Closes #4820.

Rationale for this change

Make it possible to get reference to underlying values.

What changes are included in this PR?

Are there any user-facing changes?

This is a change to the API. Existing users calling .value_data() will need to rewrite as .values().clone().

@wjones127 wjones127 added the api-change Changes to the arrow API label Sep 15, 2023
@github-actions github-actions bot added the arrow Changes to the arrow crate label Sep 15, 2023
@tustvold
Copy link
Contributor

Perhaps we should be consistent with GenericByteArray and have

/// Returns the values of this array
///
/// Unlike [`Self::value_data`] this returns the [`Buffer`]
/// allowing for zero-copy cloning
#[inline]
pub fn values(&self) -> &Buffer {
    &self.value_data
}

/// Returns the raw value data
pub fn value_data(&self) -> &[u8] {
    self.value_data.as_slice()
}

@wjones127 wjones127 marked this pull request as ready for review September 18, 2023 02:41
@wjones127 wjones127 requested a review from tustvold September 18, 2023 02:41
@tustvold tustvold merged commit 95ee5d3 into apache:master Sep 18, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make FixedSizeBinaryArray value_data return a reference
2 participants