VECTOR_AVG
functionsupportedAI & MLComputes the element-wise average of vectors in an aggregate. Returns a vector where each element is the average of the corresponding elements across all input vectors. The output is always VECTOR(FLOAT, N) regardless of input type.
Syntax
VECTOR_AVG( <vector_column> )
Parameters
| Name | Required | Description |
|---|---|---|
vector_column | required | A column containing VECTOR values. All vectors in the column must have the same element type and dimension. |
Returns
Returns a VECTOR(FLOAT, N) value where N is the dimension of the input vectors. Each element in the result vector is the average of the corresponding elements across all input vectors.
Usage notes
- NULL values are ignored in the aggregation.
- If all values in the group are NULL, the function returns NULL.
- All input vectors in the column must have the same dimension and element type.
- The output is always VECTOR(FLOAT, N) regardless of the input’s type. For information on floating-point numbers in Snowflake, see Floating-point data types.
- Vector functions are optimized in a way that can reduce floating point precision. This function’s results have a margin of error up to 1e-4.