Skip to content

Commit 9ba7446

Browse files
committed
cleanup of the percentiles aggregation
1 parent 869a69e commit 9ba7446

25 files changed

+1367
-943
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@
990990
<exclude>org/elasticsearch/plugins/PluginManager.class</exclude>
991991
<exclude>org/elasticsearch/bootstrap/Bootstrap.class</exclude>
992992
<exclude>org/elasticsearch/Version.class</exclude>
993-
<exclude>org/elasticsearch/search/aggregations/metrics/percentile/providers/tdigest/GroupTree.class</exclude>
993+
<exclude>org/elasticsearch/search/aggregations/metrics/percentile/tdigest/GroupTree.class</exclude>
994994
<!-- end excludes for valid system-out -->
995995
<!-- start excludes for Unsafe -->
996996
<exclude>org/elasticsearch/common/util/UnsafeUtils.class</exclude>

src/main/java/org/elasticsearch/search/aggregations/AggregationBuilders.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static TermsBuilder terms(String name) {
123123
return new TermsBuilder(name);
124124
}
125125

126-
public static PercentileBuilder percentile(String name) {
126+
public static PercentileBuilder percentiles(String name) {
127127
return new PercentileBuilder(name);
128128
}
129129
}

src/main/java/org/elasticsearch/search/aggregations/TransportAggregationModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import org.elasticsearch.search.aggregations.metrics.avg.InternalAvg;
3939
import org.elasticsearch.search.aggregations.metrics.max.InternalMax;
4040
import org.elasticsearch.search.aggregations.metrics.min.InternalMin;
41-
import org.elasticsearch.search.aggregations.metrics.percentile.InternalPercentile;
41+
import org.elasticsearch.search.aggregations.metrics.percentile.InternalPercentiles;
4242
import org.elasticsearch.search.aggregations.metrics.stats.InternalStats;
4343
import org.elasticsearch.search.aggregations.metrics.stats.extended.InternalExtendedStats;
4444
import org.elasticsearch.search.aggregations.metrics.sum.InternalSum;
@@ -60,7 +60,7 @@ protected void configure() {
6060
InternalStats.registerStreams();
6161
InternalExtendedStats.registerStreams();
6262
InternalValueCount.registerStreams();
63-
InternalPercentile.registerStreams();
63+
InternalPercentiles.registerStreams();
6464

6565
// buckets
6666
InternalGlobal.registerStreams();
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.search.aggregations.metrics.percentile;
21+
22+
import org.elasticsearch.search.aggregations.metrics.percentile.frugal.Frugal;
23+
import org.elasticsearch.search.aggregations.metrics.percentile.qdigest.QDigest;
24+
import org.elasticsearch.search.aggregations.metrics.percentile.tdigest.TDigest;
25+
26+
import java.util.Map;
27+
28+
/**
29+
*
30+
*/
31+
public enum InternalExecutionHint {
32+
33+
FRUGAL() {
34+
@Override
35+
public InternalPercentiles.Estimator.Factory estimatorFactory(Map <String, Object> settings) {
36+
return new Frugal.Factory();
37+
}
38+
},
39+
40+
TDIGEST() {
41+
@Override
42+
public InternalPercentiles.Estimator.Factory estimatorFactory(Map <String, Object> settings) {
43+
return new TDigest.Factory(settings);
44+
}
45+
},
46+
47+
QDIGEST() {
48+
@Override
49+
public InternalPercentiles.Estimator.Factory estimatorFactory(Map <String, Object> settings) {
50+
return new QDigest.Factory(settings);
51+
}
52+
};
53+
54+
public abstract InternalPercentiles.Estimator.Factory estimatorFactory(Map <String, Object> settings);
55+
56+
public static InternalExecutionHint resolve(String name) {
57+
if (name.equals("frugal")) {
58+
return FRUGAL;
59+
}
60+
if (name.equals("qdigest")) {
61+
return QDIGEST;
62+
}
63+
if (name.equals("tdigest")) {
64+
return TDIGEST;
65+
}
66+
return null;
67+
}
68+
69+
}

src/main/java/org/elasticsearch/search/aggregations/metrics/percentile/InternalPercentile.java

Lines changed: 0 additions & 144 deletions
This file was deleted.

0 commit comments

Comments
 (0)