You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2022/07/18 22:48:26 UTC
[datasketches-java] 01/02: better condition
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch quantiles_sketch_sorted_view
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
commit 724d7ada5b7f49db0ad45d8546a1f76b562b0728
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Mon Jul 18 15:48:01 2022 -0700
better condition
---
.../java/org/apache/datasketches/kll/KllDoublesSketchSortedView.java | 2 +-
.../java/org/apache/datasketches/kll/KllFloatsSketchSortedView.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/kll/KllDoublesSketchSortedView.java b/src/main/java/org/apache/datasketches/kll/KllDoublesSketchSortedView.java
index 7428641c..6577447e 100644
--- a/src/main/java/org/apache/datasketches/kll/KllDoublesSketchSortedView.java
+++ b/src/main/java/org/apache/datasketches/kll/KllDoublesSketchSortedView.java
@@ -62,7 +62,7 @@ public final class KllDoublesSketchSortedView {
}
public double getQuantile(final double rank) {
- if (weights_[items_.length] != n_) {
+ if (weights_[weights_.length - 1] < n_) {
throw new SketchesStateException("getQuantile must be used with cumulative view only");
}
final long pos = QuantilesHelper.posOfRank(rank, n_);
diff --git a/src/main/java/org/apache/datasketches/kll/KllFloatsSketchSortedView.java b/src/main/java/org/apache/datasketches/kll/KllFloatsSketchSortedView.java
index 250e64d0..8627fcfc 100644
--- a/src/main/java/org/apache/datasketches/kll/KllFloatsSketchSortedView.java
+++ b/src/main/java/org/apache/datasketches/kll/KllFloatsSketchSortedView.java
@@ -62,7 +62,7 @@ public final class KllFloatsSketchSortedView {
}
public float getQuantile(final double rank) {
- if (weights_[items_.length] != n_) {
+ if (weights_[weights_.length - 1] < n_) {
throw new SketchesStateException("getQuantile must be used with cumulative view only");
}
final long pos = QuantilesHelper.posOfRank(rank, n_);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org