n3world commented on a change in pull request #10662:
URL: https://github.com/apache/arrow/pull/10662#discussion_r707847507
##########
File path: cpp/src/arrow/csv/parser.cc
##########
@@ -100,6 +100,47 @@ class PresizedDataWriter {
int64_t saved_parsed_size_;
};
+/// \brief Utility class for writing one type into a buffer
+/// \tparam Type of the value stored in this buffer
+template <typename Type>
+class TypedBuffer {
+ public:
+ explicit TypedBuffer(MemoryPool* pool, int64_t capacity)
+ : size_(0), capacity_(capacity), mark_(-1) {
+ buffer_ = *AllocateResizableBuffer(capacity_ * sizeof(Type), pool);
+ typed_buffer_ = reinterpret_cast<Type*>(buffer_->mutable_data());
+ }
+
+ void Append(const Type& value) {
+ if (ARROW_PREDICT_FALSE(size_ == capacity_)) {
+ capacity_ *= 2;
+ ARROW_CHECK_OK(buffer_->Resize(capacity_ * sizeof(Type)));
Review comment:
As noted before this is a void method, so I cannot return the status
here.
--
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]