donghao526 commented on code in PR #3130:
URL: https://github.com/apache/kvrocks/pull/3130#discussion_r2471630044


##########
src/types/tdigest.h:
##########
@@ -150,3 +152,70 @@ inline StatusOr<double> TDigestQuantile(TD&& td, double q) 
{
   diff /= (lc.weight / 2 + rc.weight / 2);
   return Lerp(lc.mean, rc.mean, diff);
 }
+
+inline void AssignRankForEqualInputs(const std::vector<size_t>& indices, 
double cumulative_weight,
+                                     std::vector<int>& result) {
+  for (auto index : indices) {
+    result[index] = static_cast<int>(cumulative_weight);
+  }
+}
+
+template <typename TD>
+inline Status TDigestRevRank(TD&& td, const std::vector<double>& inputs, 
std::vector<int>& result) {
+  std::map<double, std::vector<size_t>> value_to_indices;
+  for (size_t i = 0; i < inputs.size(); ++i) {
+    value_to_indices[inputs[i]].push_back(i);

Review Comment:
   Ok, Use DoubleComparator to ensure the two double values are equal



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