Skip to content

v1.36.0 — vector_distance construct for StarRocks

Choose a tag to compare

@inviscid inviscid released this 24 Sep 17:09
9fede39

New vector_distance(metric, a, b) SQLAlchemy construct — metric leads and is positional; cosine or l2 only.

On StarRocks it compiles to (1 - cosine_similarity(a, b)) for cosine and sqrt(l2_distance(a, b)) for l2. Every other dialect raises CompileError, since the vector dtype is StarRocks-only.

Cosine distance is not bounded below by zero. An exact match returns about -1.19e-7, because StarRocks' cosine_similarity(v, v) is 1.0000001 in float32. A distance >= 0 or BETWEEN 0 AND 2 filter therefore silently drops exact matches — which are the top hit.

Ships with a two-tier conformance suite: unit-level compilation tests, plus a live tier recording measured StarRocks values that CI re-diffs on every run. The live tier has no automatic trigger yet (tracked in sc-30573).

sc-30364