Skip to main content

Module udf

Module udf 

Source
Expand description

l2_distance / cosine_distance scalar UDFs (docs/SPEC.md §2.8).

The SQL and DataFrame surface of the vector-distance operator. Both take a FixedSizeList<Float32> vector and a query vector (any list of numbers — coercion casts it to FixedSizeList<Float32> with the column’s dimension) and return a nullable Float32 distance. The scalar implementation calls the same reference arithmetic as the CPU kernel, so a projection the placement rule lowers to crate::GpuVectorDistanceExec computes exactly what the un-lowered projection would.

Constants§

COSINE_DISTANCE
Name of the cosine distance (1 - cos(θ)) UDF.
L2_DISTANCE
Name of the L2 (Euclidean) distance UDF.

Functions§

cosine_distance_udf
The cosine_distance scalar UDF.
distance_metric_for
The metric a UDF name stands for, if it is one of ours.
distance_udf_name
The UDF name for metric.
l2_distance_udf
The l2_distance scalar UDF.
literal_query
Extracts the query vector from a ScalarValue::FixedSizeList literal: one non-null row of non-null Float32s, as the placement rule requires.
oxide_udfs
Every OxideLake SQL UDF — registered on embedded sessions, cluster clients, the scheduler’s session builder and every executor’s function registry.
query_literal
The query vector as the FixedSizeList<Float32> literal our planner rule recognizes (ScalarValue::FixedSizeList, no nulls).