VECTOR_TRUNCATE
functionpartialAI & MLTruncates a VECTOR to a smaller dimension. This function can also be called through the alias VECTOR_TRUNC.
Syntax
VECTOR_TRUNCATE( <vector>, <dimension> )
Parameters
| Name | Required | Description |
|---|---|---|
vector | required | A single VECTOR value to truncate. |
dimension | required | The 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 dimension larger than the number of dimensions in the vector causes an error.
- Truncated vectors are not normalized.
Known gaps
- real Snowflake aborts VECTOR_TRUNCATE on a negative dimension with a 000603/XX000 internal error carrying a per-run incident id (its own defect, not a clean compile-time reject). The emulator raises the same 000603 family but a fixed message, so it cannot match the non-deterministic incident id.