Skip to content

Commit

Permalink
Remove abstract InternalMetricsAggregation class (#23326)
Browse files Browse the repository at this point in the history
This class doesn't seem to do much other than to group together
certain types of aggregations.
  • Loading branch information
cbuescher committed Feb 23, 2017
1 parent 2a745d2 commit fdc674a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 63 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@

import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
*
*/
public abstract class InternalNumericMetricsAggregation extends InternalMetricsAggregation {
public abstract class InternalNumericMetricsAggregation extends InternalAggregation {

private static final DocValueFormat DEFAULT_FORMAT = DocValueFormat.RAW;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public class InternalGeoBounds extends InternalMetricsAggregation implements GeoBounds {
public class InternalGeoBounds extends InternalAggregation implements GeoBounds {
private final double top;
private final double bottom;
private final double posLeft;
Expand Down Expand Up @@ -82,7 +81,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
public String getWriteableName() {
return GeoBoundsAggregationBuilder.NAME;
}

@Override
public InternalAggregation doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
double top = Double.NEGATIVE_INFINITY;
Expand Down Expand Up @@ -187,21 +186,21 @@ public XContentBuilder doXContentBody(XContentBuilder builder, Params params) th
private static class BoundingBox {
private final GeoPoint topLeft;
private final GeoPoint bottomRight;

BoundingBox(GeoPoint topLeft, GeoPoint bottomRight) {
this.topLeft = topLeft;
this.bottomRight = bottomRight;
}

public GeoPoint topLeft() {
return topLeft;
}

public GeoPoint bottomRight() {
return bottomRight;
}
}

private BoundingBox resolveBoundingBox() {
if (Double.isInfinite(top)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;

import java.io.IOException;
Expand All @@ -35,7 +34,7 @@
/**
* Serialization and merge logic for {@link GeoCentroidAggregator}.
*/
public class InternalGeoCentroid extends InternalMetricsAggregation implements GeoCentroid {
public class InternalGeoCentroid extends InternalAggregation implements GeoCentroid {
protected final GeoPoint centroid;
protected final long count;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptContext;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;

import java.io.IOException;
Expand All @@ -37,7 +36,7 @@
import java.util.List;
import java.util.Map;

public class InternalScriptedMetric extends InternalMetricsAggregation implements ScriptedMetric {
public class InternalScriptedMetric extends InternalAggregation implements ScriptedMetric {
private final Script reduceScript;
private final List<Object> aggregation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.SearchHit;

import java.io.IOException;
import java.util.List;
Expand All @@ -39,7 +38,7 @@
/**
* Results of the {@link TopHitsAggregator}.
*/
public class InternalTopHits extends InternalMetricsAggregation implements TopHits {
public class InternalTopHits extends InternalAggregation implements TopHits {
private int from;
private int size;
private TopDocs topDocs;
Expand Down Expand Up @@ -107,7 +106,7 @@ public InternalAggregation doReduce(List<InternalAggregation> aggregations, Redu
shardDocs = new TopFieldDocs[aggregations.size()];
for (int i = 0; i < shardDocs.length; i++) {
InternalTopHits topHitsAgg = (InternalTopHits) aggregations.get(i);
shardDocs[i] = (TopFieldDocs) topHitsAgg.topDocs;
shardDocs[i] = topHitsAgg.topDocs;
shardHits[i] = topHitsAgg.searchHits;
}
reducedTopDocs = TopDocs.merge(sort, from, size, (TopFieldDocs[]) shardDocs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;

import java.io.IOException;
Expand All @@ -35,7 +34,7 @@
/**
* Computes distribution statistics over multiple fields
*/
public class InternalMatrixStats extends InternalMetricsAggregation implements MatrixStats {
public class InternalMatrixStats extends InternalAggregation implements MatrixStats {
/** per shard stats needed to compute stats */
private final RunningStats stats;
/** final result */
Expand Down

0 comments on commit fdc674a

Please sign in to comment.