-
Notifications
You must be signed in to change notification settings - Fork 810
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
DictionaryArray::values() clones the underlying ArrayRef #313
Labels
api-change
Changes to the arrow API
arrow
Changes to the arrow crate
enhancement
Any new improvement worthy of a entry in the changelog
Comments
tustvold
added
the
enhancement
Any new improvement worthy of a entry in the changelog
label
May 17, 2021
tustvold
added a commit
to tustvold/arrow-rs
that referenced
this issue
May 17, 2021
Signed-off-by: Raphael Taylor-Davies <r.taylordavies@googlemail.com>
tustvold
added a commit
to tustvold/arrow-rs
that referenced
this issue
May 17, 2021
Signed-off-by: Raphael Taylor-Davies <r.taylordavies@googlemail.com>
alamb
pushed a commit
that referenced
this issue
May 21, 2021
This was referenced May 22, 2021
alamb
added
api-change
Changes to the arrow API
arrow
Changes to the arrow crate
labels
Jul 14, 2021
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
enhancement
Any new improvement worthy of a entry in the changelog
The current implementation of DictionaryArray::values() is
Aside from a redundant atomic increment on many codepaths, this prevents borrows from propagating correctly, making it challenging to borrow values out of a DictionaryArray.
For example consider a code snippet that wishes to return the first value from a DictionaryArray
Currently this won't compile because the value returned by
values()
is a stack local temporary. Given one of the motivators of using dictionaries is to avoid redundant copying of the values, this seems unfortunate.If instead the signature was
The
test
function above would compile.Another possibility would be to create a new method, e.g.
values_ref(&self)
but this seems like a bit of a hack, and returning&ArrayRef
would make DictionaryArray consistent withRecordBatch::column
.The text was updated successfully, but these errors were encountered: