The AggVariant function calls a warehouse aggregate function that returns a Variant data type. This function is the aggregate version of CallVariant and can be applied to identify distinct values from a lower grouped level in the parent/higher level grouping of a table.
AggVariant(function name, arguments...)
- function name (required): The name of an aggregate function supported by your data warehouse.
arguments (required): One or more arguments to be passed to the warehouse function. All arguments must meet the warehouse function’s input requirements.
A table contains an ARRAY_UNIQUE_AGG column that returns an array containing all the distinct customers who purchased at least one or more items per Product Type. You can pass Snowflake's ARRAY_UNION_AGG function to the AggVariant function to identify all distinct customers who made at least one purchase that week.
The ARRAY_UNION_AGG function takes in one column containing the arrays with distinct values as produced by Snowflake's ARRAY_UNIQUE_AGG function.
- Return an array that contains the union of distinct customers from the input arrays in the ARRAY_UNIQUE_AGG column.