QuakeWang commented on code in PR #725:
URL: https://github.com/apache/paimon-rust/pull/725#discussion_r3812217445


##########
crates/paimon/src/lumina/reader.rs:
##########
@@ -75,13 +91,15 @@ fn collect_results(
             continue;
         }
         let score = convert_distance_to_score(distance, metric);
+        let entry = ScoredRow { row_id, score };
         if min_heap.len() < top_k {
-            min_heap.push(ScoredRow { row_id, score });
-        } else if let Some(peek) = min_heap.peek() {
-            if score > peek.score {
-                min_heap.pop();
-                min_heap.push(ScoredRow { row_id, score });
-            }
+            min_heap.push(entry);
+        } else if min_heap

Review Comment:
   Both production callers pass exactly `effective_k` labels and the same value 
as `top_k`, so `labels.len() <= top_k` and this replacement branch cannot 
execute. The new tests trigger it only by passing more candidates than 
production can return. If ties are discarded at the native top-k cutoff, those 
rows never reach this comparator. Please enforce the tie-break before that 
cutoff (or return more than `k` candidates) and test through the real call 
contract.



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

Reply via email to