Updating a few cells in large array


#1

I have a very large array (1D, 1-billion cells), let’s call it bigArray. I want to update roughly 1000 cells and set their values. That is, I have a second array, called smallArray, which looks something like:

pos,value
1022,32
3242342,0
3342411,22

etc.

I want to update the values of bigArray only at the 1000 or so positions referenced in smallArray and set them to the corresponding value specified in smallArray. That is, after the update bigArray will be unchaged except that element 1022 will be set to 32, element 3242342 will be set to 0, element 3342411 will be set to 22 and so on.

How can I do this?


#2

If the arrays have the same schema (same attributes, same dimensions), you just need to issue
insert(smallArray, largeArray)

If the dimensions vary or if the new data comes from a flat file, you may need to put a redimension into the query so that the values match:
insert(redimension(smallArray, largeArray), largeArray)

We recently put together a paper describing this in some detail, including performance tradeoffs and versioning considerations. Take a look: paradigm4.com/forum/viewtopic.php?f=18&t=1661