EUCLIDEAN_DISTANCE()

All functions > ARRAY > EUCLIDEAN_DISTANCE()

Calculates the Euclidean distance between two arrays.

Signatures

Returns: Euclidean distance between the two vectors

EUCLIDEAN_DISTANCE(array1: ARRAY<DOUBLE>, array2: ARRAY<DOUBLE>) → DOUBLE
sql
ParameterTypeRequiredDescription
array1ARRAY<DOUBLE>YesFirst vector (array of doubles)
array2ARRAY<DOUBLE>YesSecond vector (array of doubles)

Notes

  • Computes L2 distance between two vectors
  • Formula: sqrt(sum((x[i] - y[i])^2))
  • Arrays must be same length
  • Used in ML, clustering, and similarity calculations

See also

Examples

FeatureQL
SELECT
    -- 3-4-5 triangle hypotenuse length
    f1 := EUCLIDEAN_DISTANCE(
        ARRAY(0.0e0, 3.0e0, 4.0e0),
        ARRAY(0.0e0, 0.0e0, 0.0e0)
    )
;
Result
f1 VARCHAR
5

Last update at: 2026/06/20 10:08:10