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<arrow::ArrayData> pos_data = batch->column_data(nAtts);
auto pos_values = pos_data->GetMutableValues<int64_t>(1);
for (auto i = 1; i < pos_data->length; i++)
pos_values[i] += pos_values[i - 1];

but GetMutableValues returns NULL. If I use GetValue, it works fine, but I
can't run the cumulative sum on the returned pointer since it is read-only.
I tried creating a copy of ArryaData like so:

std::shared_ptr<arrow::ArrayData> pos_data =
batch->column_data(nAtts)->Copy();

but it did not help. All this data is in CPU buffers so I'm not sure what
is the problem. What is the best way to mutate or copy & mutate it?

Thanks!
Rares

Reply via email to