pitrou commented on code in PR #45498:
URL: https://github.com/apache/arrow/pull/45498#discussion_r1952507186
##########
cpp/src/arrow/csv/parser.cc:
##########
@@ -172,11 +172,17 @@ class ResizableValueDescWriter : public
ValueDescWriter<ResizableValueDescWriter
void PushValue(ParsedValueDesc v) {
if (ARROW_PREDICT_FALSE(values_size_ == values_capacity_)) {
- values_capacity_ = values_capacity_ * 2;
- status_ &= values_buffer_->Resize(values_capacity_ * sizeof(*values_));
- values_ =
reinterpret_cast<ParsedValueDesc*>(values_buffer_->mutable_data());
+ int64_t new_capacity = values_capacity_ * 2;
+ auto resize_status = values_buffer_->Resize(new_capacity *
sizeof(*values_));
+ if (resize_status.ok()) {
+ values_ =
reinterpret_cast<ParsedValueDesc*>(values_buffer_->mutable_data());
+ values_capacity_ = new_capacity;
+ }
+ status_ &= std::move(resize_status);
+ }
+ if (ARROW_PREDICT_TRUE(status_.ok())) {
Review Comment:
I could add comments to explain this if that's useful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]