Skip to content
Blog

Array functions

This section provides an overview of functions that are specifically designed to work with ARRAY data types. An example of such a class of functions are similarity search functions, like dot product or cosine similarity. The full list of functions is provided in the table below.

FunctionDescriptionExampleResult
array_value(arg1, arg2, arg3..)creates an array containing the argument valuesarray_value(1,2,3,4,5,56,2)[1,2,3,4,5,56,2]
array_distance(array1, array2)calculates the euclidean distance between two arraysarray_distance([1.0,2.0,3.0], [4.0,5.0,6.0])5.196152
array_squared_distance(array1, array2)calculates the squared euclidean distance between two arraysarray_squared_distance([1.0,2.0,3.0], [4.0,5.0,6.0])27.000000
array_dot_product(array1, array2)calculates the dot product of two arraysarray_dot_product([1.0,2.0,3.0], [4.0,5.0,6.0])32.000000
array_inner_product(array1, array2)calculates the inner product of two arraysarray_inner_product([1.0,2.0,3.0], [4.0,5.0,6.0])32.000000
array_cross_product(array1, array2)calculates the cross product of two arraysarray_cross_product([1,2,3], [4,5,6])[-3,6,-3]
array_cosine_similarity(array1, array2)calculates the cosine similarity of two arraysarray_cosine_similarity([1.0,2.0,3.0], [4.0,5.0,6.0])0.974632