Clone the schema of an array


This should be an easy answer. I probably need to read the manual more thoroughly, but …

I am looking for a function that will clone an array’s schema. More precisely, create an empty array with the schema of another existing array.

I have an (prime) array whose schema changes over time. I also need a temporary empty array that gets some incoming re-dimensioned stuff at some intervals (daily) and I need to match the schema of the temporary array to the prime array.

I could remove and create this array, but the creation requires the schema info that I get from the prime array.
If I manually do this, it works (remove, create array <>[]… and go on).

I tried “insert * into temp from prime where someImpossibleCondition” to create the empty temp. It seems to work in that temp is indeed empty and show(temp) reveals the correct schema.

So I read something into a 1D array and try to stick it into temp using select * into temp from the 1D.
The command I am using is “insert * into temp from the1Darray” Sometimes, but not always, I get

UserException in file: src/smgr/io/Storage.cpp function: newChunk line: 2172 Error id: scidb::SCIDB_SE_STORAGE::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES Error description: Storage error. Chunk is outside of array boundaries. Failed query id: 1102445806031

If I manually remove(temp) and “create temp …” with the schema I read from prime with show() and retype, all is well.

What am I doing wrong?

BTW: prime can get to be very big and it keeps growing as things get added to it. An insert function would to the trick, but until that’s available, I am trying the merger method suggested by Alex in another posting.

Thanks and Cheers, George


Coming in Cheshire (12.10!)

SELECT stuff
FROM Source

Or if you prefer …

insert ( Target, project ( Source, stuff ) );

This will take data the the “Source” query results and append / add them to the “Target” array.

Alex P. has this code complete. We’re just beating it to death in QA.


In 12.10 we don’t allow INSERT into an array that doesn’t exist. We do allow this with the SELECT INTO statement. I just confirmed this on a relatively recent version of trunk 12.10.

Can you share with us (a) the version of SciDB you are running, (b) a copy of the logs as an attachment showing the commands leading up to the error.

There are some known limitations in the SELECT INTO aql statement (and the underlying store afl command) and those would occur with arrays with unbounded dimensions. Are you using this in your application?