github-actions[bot] commented on code in PR #65847:
URL: https://github.com/apache/doris/pull/65847#discussion_r3621083075


##########
be/src/util/tdigest.h:
##########
@@ -357,6 +358,61 @@ class TDigest {
         return quantileProcessed(q);
     }
 
+    void quantiles(const double* quantile_levels, const size_t* permutation, 
size_t size,
+                   double* result) {
+        if (size == 0) {
+            return;
+        }
+        if (haveUnprocessed() || isDirty()) {
+            process();
+        }
+
+        if (_processed.empty()) {
+            std::fill(result, result + size, NAN);
+            return;
+        }
+
+        if (_processed.size() == 1) {
+            std::fill(result, result + size, static_cast<double>(mean(0)));
+            return;
+        }
+
+        const auto n = _processed.size();
+        size_t cumulative_index = 0;
+        for (size_t result_index = 0; result_index < size; ++result_index) {
+            const size_t level_index = permutation[result_index];
+            const auto q = static_cast<Value>(quantile_levels[level_index]);
+            DORIS_CHECK(q >= 0);

Review Comment:
   These release-mode checks run for every requested quantile. The repository's 
root guide and `common/check.h` both require `DCHECK` in loops/hot paths, and 
the production caller has already validated each level in 
`PercentileApproxArrayState::init`; the remaining tail conditions are the same 
invariants guarded with `DCHECK_*` in `quantileProcessed()`. Please use 
`DCHECK_GE`/`DCHECK_LE`/`DCHECK_GT` here (and remove the now-unused 
`common/check.h`) so the new batched path does not add quantile-count-scaled 
release checks.
   



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