-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
GH-36417: [C++] Add Buffer::data_as, Buffer::mutable_data_as #36418
Conversation
cpp/src/arrow/array/array_dict.cc
Outdated
if (!dictionary_) { | ||
// FIXME this isn't thread safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File issue and mention it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or move dictionary_
init to constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Atomic shared pointer tent to use mutex
(folly has implement one using atomic swap). I guess it may hurts the performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, though an uncontended mutex should be reasonably fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up filed here #36503
will update the comment to
// FIXME this isn't thread safe | |
// TODO(GH-36503) this isn't thread safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
e719619
to
fd48a46
Compare
6457771
to
5946f60
Compare
@github-actions crossbow submit -g cpp |
Revision: 5946f60 Submitted crossbow builds: ursacomputing/crossbow @ actions-eb005cb286 |
…pache#36418) ### Rationale for this change There's a lot of boilerplate in casting buffer bytes. A templated accessor will decrease that. ### What changes are included in this PR? - `{Buffer, BufferBuilder, BufferSpan}::{data_as<T>, mutable_data_as<T>}` - rewriting a few files' worth of reinterpret_casts to use these accessors to showcase usage - `Buffer::FromVector`, a std::vector analog to Buffer::FromString - some tangential cleanup of unnecessary copies in the Array classes ### Are these changes tested? Not really. The rewritten files exercise the new accessors ### Are there any user-facing changes? No, but I've noticed `Buffer::operator[]` again and that should probably be deprecated. * Closes: apache#36417 Authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 95a8bfb. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them. |
…pache#36418) ### Rationale for this change There's a lot of boilerplate in casting buffer bytes. A templated accessor will decrease that. ### What changes are included in this PR? - `{Buffer, BufferBuilder, BufferSpan}::{data_as<T>, mutable_data_as<T>}` - rewriting a few files' worth of reinterpret_casts to use these accessors to showcase usage - `Buffer::FromVector`, a std::vector analog to Buffer::FromString - some tangential cleanup of unnecessary copies in the Array classes ### Are these changes tested? Not really. The rewritten files exercise the new accessors ### Are there any user-facing changes? No, but I've noticed `Buffer::operator[]` again and that should probably be deprecated. * Closes: apache#36417 Authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
Rationale for this change
There's a lot of boilerplate in casting buffer bytes. A templated accessor will decrease that.
What changes are included in this PR?
{Buffer, BufferBuilder, BufferSpan}::{data_as<T>, mutable_data_as<T>}
Buffer::FromVector
, a std::vector analog to Buffer::FromStringAre these changes tested?
Not really. The rewritten files exercise the new accessors
Are there any user-facing changes?
No, but I've noticed
Buffer::operator[]
again and that should probably be deprecated.