-
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
ARROW-1531: [C++] Return ToBytes by value from Decimal128 #1094
Conversation
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.
I don't think this has any performance implementations, does it? The downside of this change is that you can no longer pass l-values to this function
You can still pass them: http://en.cppreference.com/w/cpp/utility/forward
|
I mean that this code no longer works: FixedSizeBinaryBuilder builder(type);
std::array<T, SIZE> val = ...;
builder.Append(val); You would have to do |
That should still work, because that's a non-const lvalue which would be deduced to
|
I tried compiling: TEST_F(TestFWBinaryArray, Builder2) {
InitBuilder(8);
std::array<uint8_t, 8> val;
ASSERT_OK(builder_->Append<8>(val));
} ../src/arrow/array-test.cc:1207:39: error: no matching member function for call to 'Append'
do { ::arrow::Status s = (builder_->Append<8>(val)); if (!s.ok()) { return ::testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure, "../src/arrow/array-test.cc", 1207, "Failed") = ::testing::Message() << s.ToString(); } } while (0);
~~~~~~~~~~^~~~~~~~~
../src/arrow/builder.h:743:10: note: candidate function [with NBYTES = 8] not viable: no known conversion from 'std::array<uint8_t, 8>' (aka 'array<unsigned char, 8>') to 'std::array<uint8_t, 8UL> &&' (aka 'array<unsigned char, 8UL> &&') for 1st argument
Status Append(std::array<uint8_t, NBYTES>&& value) { (this works if I add |
fff1d2b
to
1e66456
Compare
…FixedSizeBinaryBuilder
1e66456
to
622fd99
Compare
Can you change the title? I'm going to cut the 0.7.0 RC after these tests pass and I can merge this |
/// \brief Put the raw bytes of the value into a pointer to uint8_t. | ||
Status ToBytes(std::array<uint8_t, 16>* out) const; | ||
/// \brief Return the raw bytes of the value. | ||
std::array<uint8_t, 16> ToBytes() const; |
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.
It might be worth having a void ToBytes(uint8_t* out) const version, too, for writing into preallocated memory
done |
Appveyor build in progress, will merge once that's looking good: https://ci.appveyor.com/project/cpcloud/arrow/build/1.0.286 |
Appveyor build is green |
I rebased this PR since then, just FYI |
No description provided.