Dan
Dan

Reputation: 31

Redshift Super Data type Querying

Redshift's new super data type uses partiql for querying. I have an array of data that is not nested eg: [0,1,2,3,4] What is the best way to query this data? All the documentation talks about nested arrays, but this is at the root level and there is no testing.

I have tried select supercolumnname[n] from tablewithsuper; and I am getting nulls, which isn't right.

Upvotes: 1

Views: 8054

Answers (1)

Hyruma92
Hyruma92

Reputation: 876

The best way (that I know right now) is to unnest the array:

CREATE TEMPORARY TABLE my_table (my_array SUPER);
INSERT INTO my_table VALUES (JSON_PARSE('[10001,10002,3333]'));
SELECT m FROM my_table as t, t.my_array as m;

Upvotes: 1

Related Questions