SnowConvert AI - BigQuery - Operators¶
IS operators¶
IS operators return TRUE or FALSE for the condition they are testing. They never return NULL, even for NULL inputs. (BigQuery SQL Language Reference IS operators)
BigQuery |
Snowflake |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNNEST operator¶
The UNNEST operator takes an array and returns a table with one row for each element in the array. (BigQuery SQL Language Reference UNNEST operator).
This operator will be emulated using the FLATTEN function, the VALUE and INDEX columns returned by the function will be renamed accordingly to match the UNNEST operator aliases
BigQuery |
Snowflake |
|---|---|
|
|
|
|
|
|
|
|
SELECT * with UNNEST¶
When the UNNEST operator is used inside a SELECT * statement the EXCLUDE keyword will be used to remove the unnecessary FLATTEN columns.
Input:
SELECT * FROM UNNEST ([10,20,30]) AS numbers WITH OFFSET position;
Generated code:
SELECT
* EXCLUDE(SEQ, KEY, PATH, THIS)
FROM
TABLE(FLATTEN(INPUT => [10,20,30])) AS numbers (
SEQ,
KEY,
PATH,
position,
numbers,
THIS
);