How append new values?



I’m trying to create an AFL to do this:


I trying to do this on this way:

AFL% create empty array A3x3 <val1:double> [i=0:2,3,0, j=0:2,3,0];
Query was executed successfully
AFL% store(build_sparse(<val1:double>[i=0:2,3,0, j=0:2,3,0], 2, i=1 and j=1), A3x3);
AFL% store(build_sparse(<val1:double>[i=0:2,3,0, j=0:2,3,0], 1.5, i=2 and j=2), A3x3);
AFL% scan(A3x3);

The problem is: the next value is not appended, but a new array is been putting over the last.
How can I append new values on certain coordinates?

Thank you for the reply!



Right now there are some different ways to achieve what you want to do:

  1. Use merge:
store( merge(build_sparse(<val1:double>[i=0:2,3,0, j=0:2,3,0], 1.5, i=2 and j=2), A3x3), A3x3);
  1. Use AQL insert:
update A3x3 set val1 = 5 where i=2 and j=2;

For absolute best performance:

  1. Make an “immutable” array. Immutable means you can ADD new chunks but not change existing chunks.
  2. Make it so that every load inserts a new chunk.

That works with least overhead. If you can’t do it this way - then do what you’re doing above.

I’m personally working on a new operator called “insert” and hopefully this will work much better in the near future!