eldenmoon commented on code in PR #65594:
URL: https://github.com/apache/doris/pull/65594#discussion_r3579503930


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownScoreTopNIntoOlapScan.java:
##########
@@ -128,6 +128,18 @@ private Plan pushDown(
                             + " for score() push down optimization");
         }
 
+        // Nested search currently produces only a parent-row bitmap. It does 
not collect or
+        // aggregate element scores into CollectionSimilarity, so allowing 
score() pushdown would
+        // silently materialize zero scores. Reject this combination until 
nested scoring semantics
+        // are implemented.
+        boolean hasTopLevelNestedSearch = filter.getConjuncts().stream()
+                .anyMatch(conjunct -> !conjunct.collect(e -> e instanceof 
SearchExpression

Review Comment:
   Fixed in 4a4cb0932b4. FE now detects NESTED recursively in the parsed search 
tree, including OR-wrapped multi-field expansion. CheckScoreUsage also rejects 
remaining score() expressions in Filter, TopN, and Sort, with tests for wrapped 
NESTED, filter-only score(), and ORDER BY-only score().



##########
be/src/exprs/function/function_search.cpp:
##########
@@ -258,6 +258,11 @@ Status 
FunctionSearch::evaluate_inverted_index_with_search_param(
         return Status::NotSupported(
                 "NESTED query requires NestedGroup support, which is 
unavailable in this build");
     }
+    if (is_nested_query && index_query_context && 
index_query_context->collection_similarity) {
+        return Status::NotSupported(
+                "NESTED search with score() is not supported until nested 
score aggregation is "

Review Comment:
   Fixed in 4a4cb0932b4. BE recursively detects any NESTED clause and returns 
INVALID_ARGUMENT before index fallback when score collection is enabled, so 
SegmentIterator cannot downgrade it as NOT_IMPLEMENTED. 
FunctionSearchNestedTest.NestedScoreReturnsNonDowngradableError verifies the 
wrapped NESTED + score path and passed locally.



-- 
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