- Categories:
VECTOR_TRUNCATE¶
Truncates a VECTOR to a smaller dimension.
This function can also be called through the alias VECTOR_TRUNC.
- See also:
Syntax¶
Arguments¶
vectorA single VECTOR value to truncate.
dimensionThe number of elements that should be in the returned vector.
Returns¶
Returns a VECTOR value with the same values and types for the first dimension entries, with the remainder discarded.
Usage notes¶
Returns NULL when any input is NULL.
Using a
dimensionlarger than the number of dimensions in thevectorcauses an error.Truncated vectors are not normalized.
Examples¶
This example demonstrates truncating a 3-dimensional vector into a 2-dimensional vector:
This example demonstrates truncating a vector produced by EMBED_TEXT_768 for the text “Analytical databases are typically column-oriented rather than row-oriented” with the snowflake-arctic-embed-m-v1.5 model from 768 elements to 256 elements: