ARRAY<T>
Translation specification for the ARRAY<T> datatype from BigQuery to Snowflake
Description
In BigQuery, an array is an ordered list of zero or more elements of non-array values. Elements in an array must share the same type. (Array Type. BigQuery)
Sample Source Patterns
Setup data
BigQuery
CREATE TABLE test.arrayTable
(
col1 ARRAY<INT64>
);
CREATE TABLE test.anotherArrayTable
(
col2 ARRAY<INT64>
);
INSERT INTO test.arrayTable VALUES ([4, 10, 55]);
INSERT INTO test.arrayTable VALUES ([6, 7, 33]);
INSERT INTO test.arrayTable VALUES ([50, 12, 22]);
INSERT INTO test.anotherArrayTable VALUES ([9, 11, 52]);
INSERT INTO test.anotherArrayTable VALUES ([3, 18, 11]);
INSERT INTO test.anotherArrayTable VALUES ([33, 27, 43]);Snowflake
INSERT with ARRAY in the VALUES clause
BigQuery
Snowflake
MERGE statement
BigQuery
Snowflake
ARRAY DEFAULT column value insertion/update
BigQuery
Snowflake
INSERT/UPDATE with NULL value
BigQuery
Snowflake
ARRAY access by index
BigQuery
Snowflake
Safe ARRAY access by index
BigQuery
Snowflake
ARRAY concatenation
BigQuery
Snowflake
ARRAY used as parameter/return type
BigQuery
Snowflake
Known Issues
1. Non-safe ARRAY access will not fail for positive out of bounds indexes
In BigQuery, accessing an array element by index will fail for any index value that is too low (underflow) or too high (overflow) when not using SAFE_OFFSET or SAFE_ORDINAL. However, in Snowflake errors are thrown only for underflow cases, any index that would case an overflow error will generate a NULL value instead.
When non-safe access to elements in an array is detected SnowConvert will generate MSCINF0055 to warn the user about this.
Related EWIs
MSCINF0057: Accessing arrays produces NULL instead of an error for positive out of bounds indexes in Snowflake.
Last updated
Was this helpful?