Gabriel39 commented on code in PR #68028:
URL: https://github.com/apache/doris/pull/68028#discussion_r4025399629


##########
fe/fe-core/src/main/java/org/apache/doris/tablefunction/VectorSearchTableValuedFunction.java:
##########
@@ -77,12 +77,16 @@ private static PreparedSearch prepare(Map<String, String> 
properties)
                 .setQueryVector(queryVector)
                 .setTopK(common.topK())
                 .setOffset(common.offset());
-        if (params.containsKey(METRIC)) {
-            vectorParams.setMetric(parseMetric(params.get(METRIC)));
-        }
+        // Pin the planner's default on every split; Lance otherwise inherits 
an index metric.
+        vectorParams.setMetric(params.containsKey(METRIC) ? 
parseMetric(params.get(METRIC)) : TVectorMetric.L2);
+        LanceVectorQuery.validateMultiVectorBudget(queryVector, common.topK(), 
common.offset(),
+                params.containsKey(REFINE_FACTOR) ? 
parsePositiveInt(params.get(REFINE_FACTOR), REFINE_FACTOR) : 1);
 
+        if (queryVector.isSetNumVectors() && vectorParams.getMetric() == 
TVectorMetric.HAMMING) {
+            throw new AnalysisException("Lance multi-vector search supports 
l2, cosine, and dot metrics");
+        }
         TExternalSearchRequest searchRequest = new TExternalSearchRequest()
-                .setSchemaVersion(1)
+                .setSchemaVersion(queryVector.isSetNumVectors() ? 2 : 1)

Review Comment:
   Updated in 80a6aaba1e. Both ordinary and multi-vector requests now use 
schema version 1; the optional num_vectors field identifies the matrix payload. 
Removed the multi-vector-specific upgrade fence and its compatibility-only 
test/documentation. Existing additional-type checks are unchanged. Validation: 
31 focused FE tests, 53 Lance BE tests, FE Checkstyle and clang-format 16 
passed. The two previously failing SQL suites also passed locally against the 
CI build of d38fba47c6; the protocol change was compiled and tested separately 
with the current FE/BE sources.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to