You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicfloatdotProduct(finalSparseVectorother) {
if (this.dimensions != other.dimensions)
thrownewIllegalArgumentException("Vector dimensions must match: " + this.dimensions + " vs " + other.dimensions);
Dimensions are inferred from the max index, but a dot product only needs the common indices (it is 0 over non-overlapping ones). SELECT vector.sparseDot(vector.sparseCreate([0,2],[0.5,0.3]), vector.sparseCreate([1,5],[0.2,0.8])) → dims 3 vs 6 → throws, when the answer is 0.0. Fix: drop the equality requirement (design bug).
vector.sparseCreate rejects long[] indices — engine/src/main/java/com/arcadedb/function/sql/vector/SQLFunctionVectorSparseCreate.java L81-108 has a private toIntArray that handles only int[] and Object[]; a long[] (how integer JSON arrays arrive from HTTP) matches neither and hits the throw new CommandSQLParsingException("Index values must be integers, found: long[]"). The shared VectorUtils.toIntArray already handles long[] (issue Bug: HTTP parameter binding loses int64 precision for ARRAY_OF_LONGS (distinct values can collapse onto the same output) #4148); this private copy shadows it. Fix: delegate to VectorUtils.toIntArray.
vector.neighbors lacks a k <= 0 guard — engine/src/main/java/com/arcadedb/function/sql/vector/SQLFunctionVectorNeighbors.java reads limit (L83) with no <= 0 check; a negative k reaches new ArrayList<>(k) in LSMVectorIndex (sinks at L4115/4201/4619/4667; the L4358 comment itself notes a negative capacity "kills the search with an Illegal Capacity that names neither") → IllegalArgumentException. The siblings rerank/recommend/discover/sparseNeighbors all return empty on k <= 0. SELECT vector.neighbors('Doc[embedding]', :q, -1). Fix: return empty (or a typed error) on k <= 0, matching the siblings.
Scope / confidence
High confidence on #1 and #2 (read at HEAD). Medium on #3 (the missing guard and the new ArrayList<>(k) sink are both present; the exact reachable sink depends on the code path). Each has a sibling that behaves correctly, so the intended behavior is established.
Activity
fix(#6391, #6386, #6387, #6384, #6383): vector sparse/ANN guards, app…
lvca commentedon Aug 19, 2026
Fixed in #6451 (merged).