Append new data to array


#1

I’m having trouble adding some data to my array. I’ve take a look at Array Join and Insert Into operators mentioned in the documentation but it wasn’t much help.

Assume I have a two dimensional array:
[i=0:*, 1000, 0 , j=0:127, 1000, 0] with a single attribute ‘val’ and it’s filled with around a thousand rows (NO EMPTY CELLS IN THE ARRAY AND NONE NULL VALUES ARE ALLOWED)

[ 0, 1, 2, 3, … 127 ]
[ 0, 1, 2, 3, … 127 ]
[ – -- – -- – -- – -- – ]
[ – -- – -- – -- – -- – ]
[ – -- – -- – -- – -- – ]
[ 0, 1, 2, 3, … 127 ] (1000x128)

now I have a new piece of data I want to add to this array. A single vector that is a (1x128) in size with also a single attribute [i=0:*, 1000, 0, j=0:127, 1000, 0]
[0, 1, 2, 3, … 127]

It doesn’t matter where in the array vector is appended i.e. bottom, top or middle

The resulting array should b of a new size (1001x128)
[ 0, 1, 2, 3, … 127 ]
[ 0, 1, 2, 3, … 127 ]
[ – -- – -- – -- – -- – ]
[ – -- – -- – -- – -- – ]
[ – -- – -- – -- – -- – ] --> row 1000
[ 0, 1, 2, 3, … 127 ] --> the new row added, row 1001

How can this be accomplished in scidb ??


#2

Hey Huda,

Of course, there are many examples of this. The form is something like this

insert(
 redimension(
   apply(
     SOURCE, 
     ...
   ), 
   TARGET
 ),
 TARGET
)

For example

insert(
 redimension(
   apply(
     build(<val:double> [j=0:127,1000,0], random()),
     i, 1001
   ), 
   <val:double> [i=0:*,1000,0, j=0:127,1000,0]
 ),
 TARGET
)

Sometimes the expression inside redimension is a lot more involved - with joins, index_lookup and so on.

Here are some examples:

  1. http://rvernica.github.io/2016/06/load-data-non-int
  2. see the last section of this doc SciDB's MAC(tm) Storage Explained
  3. https://github.com/Paradigm4/variant_warehouse/blob/master/load_gvcf/load_file.sh
    4… I’m sure you can find many others

#3

WoW I thought I had responded to this a long time ago. Oh well …

Thank you so much for the help, I did some reading on the links you provided and was able to generate the correct query form to perform the action I needed.

The “Loading Data” page was particularly helpful, so I went ahead and finished reading the other parts of it as well, and I can honestly say they have been a huge help in understanding how to query scidb.