Re: [C++] Unable to getMutableValues from ArrayData

2021-08-02 Thread Rares Vernica
Thanks all! I ended up with this and it worked fine: std::shared_ptr delta_data = _arrowBatch->column_data(nAtts); // COPY delta to pos std::vector> pos_buffers(2); pos_buffers[0] = NULL; // No nulls in the array ASSIGN_OR_THROW(pos_buffers[1],

Re: [C++] Unable to getMutableValues from ArrayData

2021-08-02 Thread Antoine Pitrou
On Fri, 30 Jul 2021 18:55:33 +0200 Rares Vernica wrote: > Hello, > > I have a RecordBatch that I read from an IPC file. I need to run a > cumulative sum on one of the int64 arrays in the batch. I tried to do: The ArrayData contents are semantically immutable. You may want to grab mutable pointe

Re: [C++] Unable to getMutableValues from ArrayData

2021-07-30 Thread Wes McKinney
IPC reads do not return mutable buffers right now, so Buffer::mutable_data will return nullptr. You need to use Buffer::Copy https://github.com/apache/arrow/blob/master/cpp/src/arrow/buffer.h#L251 You could potentially use const_cast to get a mutable pointer to a buffer returned by IPC reads, whi

Re: [C++] Unable to getMutableValues from ArrayData

2021-07-30 Thread Niranda Perera
Hi Rares, ArrayData::GetMutableValues would return a nullptr if the requested buffer is not available. https://github.com/apache/arrow/blob/557a7c63d49aa04508564517c77c71f3657d19ff/cpp/src/arrow/array/data.h#L199 What does nAtts stand for? could it be that it is OOB? On Fri, Jul 30, 2021 at 12:5

[C++] Unable to getMutableValues from ArrayData

2021-07-30 Thread Rares Vernica
Hello, I have a RecordBatch that I read from an IPC file. I need to run a cumulative sum on one of the int64 arrays in the batch. I tried to do: std::shared_ptr pos_data = batch->column_data(nAtts); auto pos_values = pos_data->GetMutableValues(1); for (auto i = 1; i < pos_data->length; i++) pos_v