This is an automated email from the ASF dual-hosted git repository.

alsay pushed a commit to branch cleanup-before-5.0.0
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git


The following commit(s) were added to refs/heads/cleanup-before-5.0.0 by this 
push:
     new 0393cf2  removed deprecated methods
0393cf2 is described below

commit 0393cf2a86ce43f172b97757e5639377b929720c
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Wed Nov 1 12:45:25 2023 -0700

    removed deprecated methods
---
 kll/include/kll_sketch.hpp                  | 35 -------------------------
 kll/include/kll_sketch_impl.hpp             | 36 --------------------------
 kll/test/kll_sketch_test.cpp                | 22 ----------------
 quantiles/include/quantiles_sketch.hpp      | 40 -----------------------------
 quantiles/include/quantiles_sketch_impl.hpp | 36 --------------------------
 quantiles/test/quantiles_sketch_test.cpp    | 23 -----------------
 req/include/req_sketch.hpp                  | 14 ----------
 req/include/req_sketch_impl.hpp             | 19 --------------
 req/test/req_sketch_test.cpp                | 16 ------------
 9 files changed, 241 deletions(-)

diff --git a/kll/include/kll_sketch.hpp b/kll/include/kll_sketch.hpp
index 3953d60..e48e39c 100644
--- a/kll/include/kll_sketch.hpp
+++ b/kll/include/kll_sketch.hpp
@@ -275,41 +275,6 @@ class kll_sketch {
      */
     quantile_return_type get_quantile(double rank, bool inclusive = true) 
const;
 
-    /**
-     * This returns an array that could have been generated by using 
get_quantile() for each
-     * rank separately.
-     *
-     * <p>If the sketch is empty this throws std::runtime_error.
-     *
-     * @param ranks given array of ranks in the hypothetical sorted stream.
-     * These ranks must be in the interval [0.0, 1.0].
-     * @param size the number of ranks in the array
-     * @param inclusive if true, the given ranks are considered inclusive 
(include weights of items)
-     *
-     * @return array of approximate quantiles corresponding to the given ranks 
in the same order.
-     *
-     * Deprecated. Will be removed in the next major version. Use 
get_quantile() instead.
-     */
-    std::vector<T, A> get_quantiles(const double* ranks, uint32_t size, bool 
inclusive = true) const;
-
-    /**
-     * This is a multiple-query version of get_quantile() that allows the 
caller to
-     * specify the number of evenly-spaced ranks.
-     *
-     * <p>If the sketch is empty this throws std::runtime_error.
-     *
-     * @param num an integer that specifies the number of evenly-spaced ranks.
-     * This must be an integer greater than 0. A value of 1 will return the 
quantile of rank 0.
-     * A value of 2 will return quantiles of ranks 0 and 1. A value of 3 will 
return quantiles of ranks 0,
-     * 0.5 (median) and 1, etc.
-     * @param inclusive if true, the ranks are considered inclusive (include 
weights of items)
-     *
-     * @return array of approximate quantiles corresponding to the given 
number of evenly-spaced ranks.
-     *
-     * Deprecated. Will be removed in the next major version. Use 
get_quantile() instead.
-     */
-    std::vector<T, A> get_quantiles(uint32_t num, bool inclusive = true) const;
-
     /**
      * Returns an approximation to the normalized rank of the given item from 
0 to 1, inclusive.
      *
diff --git a/kll/include/kll_sketch_impl.hpp b/kll/include/kll_sketch_impl.hpp
index 8608c73..fde0a31 100644
--- a/kll/include/kll_sketch_impl.hpp
+++ b/kll/include/kll_sketch_impl.hpp
@@ -309,42 +309,6 @@ auto kll_sketch<T, C, A>::get_quantile(double rank, bool 
inclusive) const -> qua
   return sorted_view_->get_quantile(rank, inclusive);
 }
 
-template<typename T, typename C, typename A>
-std::vector<T, A> kll_sketch<T, C, A>::get_quantiles(const double* ranks, 
uint32_t size, bool inclusive) const {
-  if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
-  std::vector<T, A> quantiles(allocator_);
-  quantiles.reserve(size);
-
-  // may have a side effect of sorting level zero if needed
-  setup_sorted_view();
-
-  for (uint32_t i = 0; i < size; i++) {
-    const double rank = ranks[i];
-    if ((rank < 0.0) || (rank > 1.0)) {
-      throw std::invalid_argument("normalized rank cannot be less than 0 or 
greater than 1");
-    }
-    quantiles.push_back(sorted_view_->get_quantile(rank, inclusive));
-  }
-  return quantiles;
-}
-
-template<typename T, typename C, typename A>
-std::vector<T, A> kll_sketch<T, C, A>::get_quantiles(uint32_t num, bool 
inclusive) const {
-  if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
-  if (num == 0) {
-    throw std::invalid_argument("num must be > 0");
-  }
-  vector_double ranks(num, 0, allocator_);
-  ranks[0] = 0.0;
-  for (size_t i = 1; i < num; i++) {
-    ranks[i] = static_cast<double>(i) / (num - 1);
-  }
-  if (num > 1) {
-    ranks[num - 1] = 1.0;
-  }
-  return get_quantiles(ranks.data(), num, inclusive);
-}
-
 template<typename T, typename C, typename A>
 double kll_sketch<T, C, A>::get_normalized_rank_error(bool pmf) const {
   return get_normalized_rank_error(min_k_, pmf);
diff --git a/kll/test/kll_sketch_test.cpp b/kll/test/kll_sketch_test.cpp
index 692d0a5..b8d0b03 100644
--- a/kll/test/kll_sketch_test.cpp
+++ b/kll/test/kll_sketch_test.cpp
@@ -67,8 +67,6 @@ TEST_CASE("kll sketch", "[kll_sketch]") {
     REQUIRE_THROWS_AS(sketch.get_max_item(), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_rank(0), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_quantile(0.5), std::runtime_error);
-    const double ranks[3] {0, 0.5, 1};
-    REQUIRE_THROWS_AS(sketch.get_quantiles(ranks, 3), std::runtime_error);
     const float split_points[1] {0};
     REQUIRE_THROWS_AS(sketch.get_PMF(split_points, 1), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_CDF(split_points, 1), std::runtime_error);
@@ -99,12 +97,6 @@ TEST_CASE("kll sketch", "[kll_sketch]") {
     REQUIRE(sketch.get_min_item() == 1.0);
     REQUIRE(sketch.get_max_item() == 1.0);
     REQUIRE(sketch.get_quantile(0.5) == 1.0);
-    const double ranks[3] {0, 0.5, 1};
-    auto quantiles = sketch.get_quantiles(ranks, 3);
-    REQUIRE(quantiles.size() == 3);
-    REQUIRE(quantiles[0] == 1.0);
-    REQUIRE(quantiles[1] == 1.0);
-    REQUIRE(quantiles[2] == 1.0);
 
     int count = 0;
     for (auto pair: sketch) {
@@ -144,20 +136,6 @@ TEST_CASE("kll sketch", "[kll_sketch]") {
     REQUIRE(sketch.get_max_item() == n);
     REQUIRE(sketch.get_quantile(1) == n);
 
-    const double ranks[3] {0, 0.5, 1};
-    auto quantiles = sketch.get_quantiles(ranks, 3);
-    REQUIRE(quantiles.size() == 3);
-    REQUIRE(quantiles[0] == 1);
-    REQUIRE(quantiles[1] == n / 2);
-    REQUIRE(quantiles[2] == n);
-
-    // alternative method must produce the same result
-    auto quantiles2 = sketch.get_quantiles(3);
-    REQUIRE(quantiles2.size() == 3);
-    REQUIRE(quantiles[0] == quantiles2[0]);
-    REQUIRE(quantiles[1] == quantiles2[1]);
-    REQUIRE(quantiles[2] == quantiles2[2]);
-
     for (uint32_t i = 1; i <= n; i++) {
       const double true_rank_inclusive = static_cast<double>(i) / n;
       REQUIRE(sketch.get_rank(static_cast<float>(i)) == true_rank_inclusive);
diff --git a/quantiles/include/quantiles_sketch.hpp 
b/quantiles/include/quantiles_sketch.hpp
index 9fb938f..0e63a35 100644
--- a/quantiles/include/quantiles_sketch.hpp
+++ b/quantiles/include/quantiles_sketch.hpp
@@ -288,46 +288,6 @@ public:
    */
   quantile_return_type get_quantile(double rank, bool inclusive = true) const;
 
-  /**
-   * This is a multiple-query version of get_quantile().
-   * <p>
-   * This returns an array that could have been generated by using 
get_quantile() for each
-   * normalized rank separately.
-   *
-   * <p>If the sketch is empty this throws std::runtime_error.
-   *
-   * @param ranks given array of normalized ranks in the hypothetical sorted 
stream.
-   * These ranks must be in the interval [0.0, 1.0], inclusive.
-   * @param size the number of ranks in the array
-   * @param inclusive if true the weight of the given item is included into 
the rank.
-   * Otherwise the rank equals the sum of the weights of all items that are 
less than the given item
-   * according to the Comparator.
-   * @return array of approximations to items associated with given ranks in 
the same order as given ranks
-   * in the input array.
-   *
-   * Deprecated. Will be removed in the next major version. Use get_quantile() 
instead.
-   */
-  std::vector<T, Allocator> get_quantiles(const double* ranks, uint32_t size, 
bool inclusive = true) const;
-
-  /**
-   * This is a multiple-query version of get_quantile() that allows the caller 
to
-   * specify the number of evenly-spaced normalized ranks.
-   *
-   * <p>If the sketch is empty this throws std::runtime_error.
-   *
-   * @param num an integer that specifies the number of evenly-spaced ranks.
-   * This must be an integer greater than 0. A value of 1 is equivalent to 
get_quantiles([0]).
-   * A value of 2 is equivalent to get_quantiles([0, 1]). A value of 3 is 
equivalent to
-   * get_quantiles([0, 0.5, 1]), etc.
-   * @param inclusive if true the weight of the given item is included into 
the rank.
-   * Otherwise the rank equals the sum of the weights of all items that are 
less than the given item
-   * according to the Comparator.
-   * @return array of approximations to items associated with the given number 
of evenly-spaced normalized ranks.
-   *
-   * Deprecated. Will be removed in the next major version. Use get_quantile() 
instead.
-   */
-  std::vector<T, Allocator> get_quantiles(uint32_t num, bool inclusive = true) 
const;
-
   /**
    * Returns an approximation to the normalized rank of the given item from 0 
to 1, inclusive.
    *
diff --git a/quantiles/include/quantiles_sketch_impl.hpp 
b/quantiles/include/quantiles_sketch_impl.hpp
index d673a3f..1234e08 100644
--- a/quantiles/include/quantiles_sketch_impl.hpp
+++ b/quantiles/include/quantiles_sketch_impl.hpp
@@ -751,42 +751,6 @@ auto quantiles_sketch<T, C, A>::get_quantile(double rank, 
bool inclusive) const
   return sorted_view_->get_quantile(rank, inclusive);
 }
 
-template<typename T, typename C, typename A>
-std::vector<T, A> quantiles_sketch<T, C, A>::get_quantiles(const double* 
ranks, uint32_t size, bool inclusive) const {
-  if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
-  std::vector<T, A> quantiles(allocator_);
-  quantiles.reserve(size);
-
-  // possible side-effect: sorting base buffer
-  setup_sorted_view();
-
-  for (uint32_t i = 0; i < size; ++i) {
-    const double rank = ranks[i];
-    if ((rank < 0.0) || (rank > 1.0)) {
-      throw std::invalid_argument("Normalized rank cannot be less than 0 or 
greater than 1");
-    }
-    quantiles.push_back(sorted_view_->get_quantile(rank, inclusive));
-  }
-  return quantiles;
-}
-
-template<typename T, typename C, typename A>
-std::vector<T, A> quantiles_sketch<T, C, A>::get_quantiles(uint32_t num, bool 
inclusive) const {
-  if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
-  if (num == 0) {
-    throw std::invalid_argument("num must be > 0");
-  }
-  vector_double ranks(num, 0, allocator_);
-  ranks[0] = 0.0;
-  for (size_t i = 1; i < num; i++) {
-    ranks[i] = static_cast<double>(i) / (num - 1);
-  }
-  if (num > 1) {
-    ranks[num - 1] = 1.0;
-  }
-  return get_quantiles(ranks.data(), num, inclusive);
-}
-
 template<typename T, typename C, typename A>
 double quantiles_sketch<T, C, A>::get_rank(const T& item, bool inclusive) 
const {
   if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
diff --git a/quantiles/test/quantiles_sketch_test.cpp 
b/quantiles/test/quantiles_sketch_test.cpp
index 03640e8..8230f6a 100644
--- a/quantiles/test/quantiles_sketch_test.cpp
+++ b/quantiles/test/quantiles_sketch_test.cpp
@@ -65,8 +65,6 @@ TEST_CASE("quantiles sketch", "[quantiles_sketch]") {
     REQUIRE_THROWS_AS(sketch.get_max_item(), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_rank(0), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_quantile(0.5), std::runtime_error);
-    const double fractions[3] {0, 0.5, 1};
-    REQUIRE_THROWS_AS(sketch.get_quantiles(fractions, 3).empty(), 
std::runtime_error);
     const float split_points[1] {0};
     REQUIRE_THROWS_AS(sketch.get_PMF(split_points, 1), std::runtime_error);
     REQUIRE_THROWS_AS(sketch.get_CDF(split_points, 1), std::runtime_error);
@@ -98,13 +96,6 @@ TEST_CASE("quantiles sketch", "[quantiles_sketch]") {
     REQUIRE(sketch.get_max_item() == 1.0);
     REQUIRE(sketch.get_quantile(0.5) == 1.0);
 
-    const double fractions[3] {0, 0.5, 1};
-    auto quantiles = sketch.get_quantiles(fractions, 3);
-    REQUIRE(quantiles.size() == 3);
-    REQUIRE(quantiles[0] == 1.0);
-    REQUIRE(quantiles[1] == 1.0);
-    REQUIRE(quantiles[2] == 1.0);
-
     int count = 0;
     for (auto pair: sketch) {
       REQUIRE(pair.second == 1);
@@ -153,20 +144,6 @@ TEST_CASE("quantiles sketch", "[quantiles_sketch]") {
     REQUIRE(sketch.get_max_item() == n);
     REQUIRE(sketch.get_quantile(1) == n);
 
-    const double ranks[3] {0, 0.5, 1};
-    auto quantiles = sketch.get_quantiles(ranks, 3);
-    REQUIRE(quantiles.size() == 3);
-    REQUIRE(quantiles[0] == 1);
-    REQUIRE(quantiles[1] == static_cast<float>(n / 2));
-    REQUIRE(quantiles[2] == n);
-
-    // the alternative method must produce the same result
-    auto quantiles2 = sketch.get_quantiles(3);
-    REQUIRE(quantiles2.size() == 3);
-    REQUIRE(quantiles[0] == quantiles2[0]);
-    REQUIRE(quantiles[1] == quantiles2[1]);
-    REQUIRE(quantiles[2] == quantiles2[2]);
-
     int count = 0;
     for (auto pair: sketch) {
       REQUIRE(pair.second == 1);
diff --git a/req/include/req_sketch.hpp b/req/include/req_sketch.hpp
index 09afedb..6923440 100755
--- a/req/include/req_sketch.hpp
+++ b/req/include/req_sketch.hpp
@@ -287,20 +287,6 @@ public:
    */
   quantile_return_type get_quantile(double rank, bool inclusive = true) const;
 
-  /**
-   * Returns an array of quantiles that correspond to the given array of 
normalized ranks.
-   * <p>If the sketch is empty this throws std::runtime_error.
-   *
-   * @param ranks given array of normalized ranks.
-   * @param size the number of ranks in the array.
-   * @param inclusive if true, the given rank is considered inclusive 
(includes weight of an item)
-   *
-   * @return array of quantiles that correspond to the given array of 
normalized ranks
-   *
-   * Deprecated. Will be removed in the next major version. Use get_quantile() 
instead.
-   */
-  std::vector<T, Allocator> get_quantiles(const double* ranks, uint32_t size, 
bool inclusive = true) const;
-
   /**
    * Returns an approximate lower bound of the given normalized rank.
    * @param rank the given rank, a value between 0 and 1.0.
diff --git a/req/include/req_sketch_impl.hpp b/req/include/req_sketch_impl.hpp
index 530756f..a28e74e 100755
--- a/req/include/req_sketch_impl.hpp
+++ b/req/include/req_sketch_impl.hpp
@@ -265,25 +265,6 @@ auto req_sketch<T, C, A>::get_quantile(double rank, bool 
inclusive) const -> qua
   return sorted_view_->get_quantile(rank, inclusive);
 }
 
-template<typename T, typename C, typename A>
-std::vector<T, A> req_sketch<T, C, A>::get_quantiles(const double* ranks, 
uint32_t size, bool inclusive) const {
-  if (is_empty()) throw std::runtime_error("operation is undefined for an 
empty sketch");
-  std::vector<T, A> quantiles(allocator_);
-  quantiles.reserve(size);
-
-  // possible side-effect of sorting level zero
-  setup_sorted_view();
-
-  for (uint32_t i = 0; i < size; ++i) {
-    const double rank = ranks[i];
-    if ((rank < 0.0) || (rank > 1.0)) {
-      throw std::invalid_argument("Normalized rank cannot be less than 0 or 
greater than 1");
-    }
-    quantiles.push_back(sorted_view_->get_quantile(rank, inclusive));
-  }
-  return quantiles;
-}
-
 template<typename T, typename C, typename A>
 quantiles_sorted_view<T, C, A> req_sketch<T, C, A>::get_sorted_view() const {
   if (!compactors_[0].is_sorted()) {
diff --git a/req/test/req_sketch_test.cpp b/req/test/req_sketch_test.cpp
index 3aa411b..2a338b8 100755
--- a/req/test/req_sketch_test.cpp
+++ b/req/test/req_sketch_test.cpp
@@ -47,8 +47,6 @@ TEST_CASE("req sketch: empty", "[req_sketch]") {
   REQUIRE_THROWS_AS(sketch.get_max_item(), std::runtime_error);
   REQUIRE_THROWS_AS(sketch.get_rank(0), std::runtime_error);
   REQUIRE_THROWS_AS(sketch.get_quantile(0), std::runtime_error);
-  const double ranks[3] {0, 0.5, 1};
-  REQUIRE_THROWS_AS(sketch.get_quantiles(ranks, 3), std::runtime_error);
 
   const float split_points[1] {0};
   REQUIRE_THROWS_AS(sketch.get_CDF(split_points, 1), std::runtime_error);
@@ -71,13 +69,6 @@ TEST_CASE("req sketch: single value, lra", "[req_sketch]") {
   REQUIRE(sketch.get_quantile(0.5, false) == 1);
   REQUIRE(sketch.get_quantile(1, false) == 1);
 
-  const double ranks[3] {0, 0.5, 1};
-  auto quantiles = sketch.get_quantiles(ranks, 3);
-  REQUIRE(quantiles.size() == 3);
-  REQUIRE(quantiles[0] == 1);
-  REQUIRE(quantiles[1] == 1);
-  REQUIRE(quantiles[2] == 1);
-
   unsigned count = 0;
   for (auto pair: sketch) {
     REQUIRE(pair.second == 1);
@@ -145,13 +136,6 @@ TEST_CASE("req sketch: exact mode", "[req_sketch]") {
   REQUIRE(sketch.get_quantile(0.9) == 9);
   REQUIRE(sketch.get_quantile(1) == 10);
 
-  const double ranks[3] {0, 0.5, 1};
-  auto quantiles = sketch.get_quantiles(ranks, 3);
-  REQUIRE(quantiles.size() == 3);
-  REQUIRE(quantiles[0] == 1);
-  REQUIRE(quantiles[1] == 5);
-  REQUIRE(quantiles[2] == 10);
-
   const float splits[3] {2, 6, 9};
   auto cdf = sketch.get_CDF(splits, 3, false);
   REQUIRE(cdf[0] == 0.1);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to