You are viewing documentation about an older version (1.18.0). View latest version

snowflake.snowpark.functions.vector_l2_distance¶

snowflake.snowpark.functions.vector_l2_distance(v1: Union[Column, str], v2: Union[Column, str]) → Column[source]¶

Returns the l2 distance between two vectors of equal dimension and element type.

Example::
>>> from snowflake.snowpark.functions import vector_l2_distance
>>> df = session.sql("select [1,2,3]::vector(int,3) as a, [2,3,4]::vector(int,3) as b")
>>> df.select(vector_l2_distance(df.a, df.b).as_("dist")).show()
----------------------
|"DIST"              |
----------------------
|1.7320508075688772  |
----------------------
Copy