Other types

Table of Content


ROW

A row type is a composite data type made up of multiple fields, each with its own type—similar to a tuple in programming languages like Python.

Currently, CrateDB does not provide a row type literal for directly creating such values. However, the type is used implicitly as the result of table functions in the SELECT list when those functions return more than one column.

Example:

sqlCopierModifier-- The unnest() function returns two columns per row,
-- which are combined into a ROW type.
cr> SELECT unnest([1, 2], ['Arthur', 'Trillian']);
+----------------------------------------+
| unnest([1, 2], ['Arthur', 'Trillian']) |
+----------------------------------------+
| [1, "Arthur"]                          |
| [2, "Trillian"]                        |
+----------------------------------------+
SELECT 2 rows in set (... sec)

FLOAT_VECTOR

A FLOAT_VECTOR is a data type for storing dense, fixed-length vectors of FLOAT values.

It is primarily used for vector similarity search, supporting the KNN_MATCH function for k-nearest neighbor queries. This allows you to find the most similar vectors in a dataset to a given query vector.

Key Characteristics

  • Fixed length: The dimension (number of elements) must be specified when creating the column.

  • Specialized use: Cannot be used as the element type of a regular array.

  • Definition syntax is similar to float arrays, but with a dimension declared.


Example Usage

Last updated