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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckScoreUsage.java:
##########
@@ -66,10 +66,38 @@ public List<Rule> buildRules() {
                             "score() function cannot be used in aggregate 
functions. "
                             + "score() requires WHERE clause with MATCH 
function, "
                             + "ORDER BY and LIMIT for optimization");
+                }).toRule(RuleType.CHECK_SCORE_USAGE),
+
+            logicalFilter()

Review Comment:
   Fixed in 66e07a70a62. CheckScoreUsage now applies a generic post-pushdown 
check to every plan-owned expression container, while exempting only the 
optimized LogicalProject and LogicalOlapScan shapes. This covers LogicalWindow 
and LogicalJoin as well as filters and order keys. Added a negative LogicalJoin 
conjunct test; the focused FE suite passes 4/4.



##########
be/src/exprs/function/function_search.cpp:
##########
@@ -253,13 +265,20 @@ Status 
FunctionSearch::evaluate_inverted_index_with_search_param(
         const IndexExecContext* index_exec_ctx,
         const std::unordered_map<std::string, int>& field_name_to_column_id,
         const std::shared_ptr<IndexQueryContext>& index_query_context) const {
-    const bool is_nested_query = search_param.root.clause_type == "NESTED";
-    if (is_nested_query && !is_nested_group_search_supported()) {
+    const bool has_nested_query = 
search_clause_contains_nested(search_param.root);
+    if (has_nested_query && index_query_context && 
index_query_context->collection_similarity) {
+        return Status::InvalidArgument(
+                "NESTED search with score() is not supported until nested 
score aggregation is "
+                "implemented");
+    }
+
+    const bool is_top_level_nested_query = search_param.root.clause_type == 
"NESTED";
+    if (is_top_level_nested_query && !is_nested_group_search_supported()) {
         return Status::NotSupported(
                 "NESTED query requires NestedGroup support, which is 
unavailable in this build");
     }
 
-    if (!is_nested_query && (iterators.empty() || 
data_type_with_names.empty())) {
+    if (!has_nested_query && (iterators.empty() || 
data_type_with_names.empty())) {

Review Comment:
   Fixed in 66e07a70a62. The empty-input fallback now distinguishes root NESTED 
from recursively wrapped NESTED: wrapped NESTED without score keeps the 
existing empty-result behavior, while wrapped NESTED with score proceeds to the 
non-downgradable INVALID_ARGUMENT guard. Added 
WrappedNestedWithoutScoreKeepsEmptyInputFallback; both focused BE tests pass.



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