INSERT into array column



I’m trying to workout the INSERT syntax for array columns, as I couldn’t see it under the docs> - maybe I’ve just missed it.

I thought it might be comma-separated values surrounded by braces based on this - This works from StreamInsert but not via SQL in mapdql.

I have an array of integers I’m trying to insert.



There is no current support from the ‘INSERT’ statement for array columns. You must use a programmatic insert mechanism as you describe , like streamInserter. It will be added as time allows and customers requirements justify/demand. It could be a nice project for someone to explore the MapD code base and add the feature :slight_smile:



Ha, thanks @dwayneberry. Yeah, we’ll see about the side project, it would be a great feature to have.

I’m guessing then that this also means that I wouldn’t be able to pass in a array of ints to an extension function as follows (because the syntax doesn’t exist):

SELECT a FROM mytable WHERE myfun(b, {1,3,27}) < 20;

I suspect I know the answer to this, but I live in hope/denial : o


Hi @owenrh,

Just to follow up here, as of the 4.0 release you can do inserts of literal arrays that are not of text type (as seen below). Hopefully that will come in a later release.

mapdql> insert into array_test (a) values ({3, 2, 5, 2});
mapdql> select * from array_test;
{3, 2, 5, 2}



Great thanks for the update.