Fix test bug: a too low compression level can make accuracy terrible.

This commit is contained in:
Adrien Grand 2014-03-03 20:31:38 +01:00
parent 7b16c5857d
commit 0230ecbeac
1 changed files with 2 additions and 2 deletions

View File

@ -23,10 +23,10 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Order; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Order;
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesBuilder;
import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles; import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles;
import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles.Estimator.TDigest; import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles.Estimator.TDigest;
import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles.Percentile; import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles.Percentile;
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesBuilder;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
@ -66,7 +66,7 @@ public class PercentilesTests extends AbstractNumericTests {
private static PercentilesBuilder randomEstimator(PercentilesBuilder builder) { private static PercentilesBuilder randomEstimator(PercentilesBuilder builder) {
if (randomBoolean()) { if (randomBoolean()) {
TDigest estimator = TDigest.tDigest(); TDigest estimator = TDigest.tDigest();
estimator.compression(randomDouble() * 100); estimator.compression(randomIntBetween(20, 120) + randomDouble());
builder.estimator(estimator); builder.estimator(estimator);
} }
return builder; return builder;