Rename InternalFilters.Bucket to InternalFilters.InternalBucket to avoid name collision
This commit is contained in:
parent
beec7ca9db
commit
690fb2cd3f
|
@ -112,16 +112,16 @@ public class FiltersAggregator extends BucketsAggregator {
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
List<InternalFilters.Bucket> buckets = new ArrayList<>(filters.length);
|
||||
List<InternalFilters.InternalBucket> buckets = new ArrayList<>(filters.length);
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
long bucketOrd = bucketOrd(owningBucketOrdinal, i);
|
||||
InternalFilters.Bucket bucket = new InternalFilters.Bucket(keys[i], bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed);
|
||||
InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(keys[i], bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed);
|
||||
buckets.add(bucket);
|
||||
}
|
||||
// other bucket
|
||||
if (showOtherBucket) {
|
||||
long bucketOrd = bucketOrd(owningBucketOrdinal, keys.length);
|
||||
InternalFilters.Bucket bucket = new InternalFilters.Bucket(otherBucketKey, bucketDocCount(bucketOrd),
|
||||
InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(otherBucketKey, bucketDocCount(bucketOrd),
|
||||
bucketAggregations(bucketOrd), keyed);
|
||||
buckets.add(bucket);
|
||||
}
|
||||
|
@ -131,9 +131,9 @@ public class FiltersAggregator extends BucketsAggregator {
|
|||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
InternalAggregations subAggs = buildEmptySubAggregations();
|
||||
List<InternalFilters.Bucket> buckets = new ArrayList<>(filters.length);
|
||||
List<InternalFilters.InternalBucket> buckets = new ArrayList<>(filters.length);
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
InternalFilters.Bucket bucket = new InternalFilters.Bucket(keys[i], 0, subAggs, keyed);
|
||||
InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(keys[i], 0, subAggs, keyed);
|
||||
buckets.add(bucket);
|
||||
}
|
||||
return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metaData());
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.Map;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class InternalFilters extends InternalMultiBucketAggregation<InternalFilters, InternalFilters.Bucket> implements Filters {
|
||||
public class InternalFilters extends InternalMultiBucketAggregation<InternalFilters, InternalFilters.InternalBucket> implements Filters {
|
||||
|
||||
public final static Type TYPE = new Type("filters");
|
||||
|
||||
|
@ -53,16 +53,16 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
}
|
||||
};
|
||||
|
||||
private final static BucketStreams.Stream<Bucket> BUCKET_STREAM = new BucketStreams.Stream<Bucket>() {
|
||||
private final static BucketStreams.Stream<InternalBucket> BUCKET_STREAM = new BucketStreams.Stream<InternalBucket>() {
|
||||
@Override
|
||||
public Bucket readResult(StreamInput in, BucketStreamContext context) throws IOException {
|
||||
Bucket filters = new Bucket(context.keyed());
|
||||
public InternalBucket readResult(StreamInput in, BucketStreamContext context) throws IOException {
|
||||
InternalBucket filters = new InternalBucket(context.keyed());
|
||||
filters.readFrom(in);
|
||||
return filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BucketStreamContext getBucketStreamContext(Bucket bucket) {
|
||||
public BucketStreamContext getBucketStreamContext(InternalBucket bucket) {
|
||||
BucketStreamContext context = new BucketStreamContext();
|
||||
context.keyed(bucket.keyed);
|
||||
return context;
|
||||
|
@ -74,19 +74,19 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
BucketStreams.registerStream(BUCKET_STREAM, TYPE.stream());
|
||||
}
|
||||
|
||||
public static class Bucket extends InternalBucket implements Filters.Bucket {
|
||||
public static class InternalBucket extends InternalMultiBucketAggregation.InternalBucket implements Filters.Bucket {
|
||||
|
||||
private final boolean keyed;
|
||||
private String key;
|
||||
private long docCount;
|
||||
InternalAggregations aggregations;
|
||||
|
||||
private Bucket(boolean keyed) {
|
||||
private InternalBucket(boolean keyed) {
|
||||
// for serialization
|
||||
this.keyed = keyed;
|
||||
}
|
||||
|
||||
public Bucket(String key, long docCount, InternalAggregations aggregations, boolean keyed) {
|
||||
public InternalBucket(String key, long docCount, InternalAggregations aggregations, boolean keyed) {
|
||||
this.key = key;
|
||||
this.docCount = docCount;
|
||||
this.aggregations = aggregations;
|
||||
|
@ -113,12 +113,12 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
return aggregations;
|
||||
}
|
||||
|
||||
Bucket reduce(List<Bucket> buckets, ReduceContext context) {
|
||||
Bucket reduced = null;
|
||||
InternalBucket reduce(List<InternalBucket> buckets, ReduceContext context) {
|
||||
InternalBucket reduced = null;
|
||||
List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
|
||||
for (Bucket bucket : buckets) {
|
||||
for (InternalBucket bucket : buckets) {
|
||||
if (reduced == null) {
|
||||
reduced = new Bucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed);
|
||||
reduced = new InternalBucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed);
|
||||
} else {
|
||||
reduced.docCount += bucket.docCount;
|
||||
}
|
||||
|
@ -156,13 +156,13 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
}
|
||||
}
|
||||
|
||||
private List<Bucket> buckets;
|
||||
private Map<String, Bucket> bucketMap;
|
||||
private List<InternalBucket> buckets;
|
||||
private Map<String, InternalBucket> bucketMap;
|
||||
private boolean keyed;
|
||||
|
||||
public InternalFilters() {} // for serialization
|
||||
|
||||
public InternalFilters(String name, List<Bucket> buckets, boolean keyed, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
|
||||
public InternalFilters(String name, List<InternalBucket> buckets, boolean keyed, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
|
||||
super(name, pipelineAggregators, metaData);
|
||||
this.buckets = buckets;
|
||||
this.keyed = keyed;
|
||||
|
@ -174,25 +174,25 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
}
|
||||
|
||||
@Override
|
||||
public InternalFilters create(List<Bucket> buckets) {
|
||||
public InternalFilters create(List<InternalBucket> buckets) {
|
||||
return new InternalFilters(this.name, buckets, this.keyed, this.pipelineAggregators(), this.metaData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bucket createBucket(InternalAggregations aggregations, Bucket prototype) {
|
||||
return new Bucket(prototype.key, prototype.docCount, aggregations, prototype.keyed);
|
||||
public InternalBucket createBucket(InternalAggregations aggregations, InternalBucket prototype) {
|
||||
return new InternalBucket(prototype.key, prototype.docCount, aggregations, prototype.keyed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Bucket> getBuckets() {
|
||||
public List<InternalBucket> getBuckets() {
|
||||
return buckets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bucket getBucketByKey(String key) {
|
||||
public InternalBucket getBucketByKey(String key) {
|
||||
if (bucketMap == null) {
|
||||
bucketMap = new HashMap<>(buckets.size());
|
||||
for (Bucket bucket : buckets) {
|
||||
for (InternalBucket bucket : buckets) {
|
||||
bucketMap.put(bucket.getKey(), bucket);
|
||||
}
|
||||
}
|
||||
|
@ -201,26 +201,26 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
|
||||
@Override
|
||||
public InternalAggregation doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
|
||||
List<List<Bucket>> bucketsList = null;
|
||||
List<List<InternalBucket>> bucketsList = null;
|
||||
for (InternalAggregation aggregation : aggregations) {
|
||||
InternalFilters filters = (InternalFilters) aggregation;
|
||||
if (bucketsList == null) {
|
||||
bucketsList = new ArrayList<>(filters.buckets.size());
|
||||
for (Bucket bucket : filters.buckets) {
|
||||
List<Bucket> sameRangeList = new ArrayList<>(aggregations.size());
|
||||
for (InternalBucket bucket : filters.buckets) {
|
||||
List<InternalBucket> sameRangeList = new ArrayList<>(aggregations.size());
|
||||
sameRangeList.add(bucket);
|
||||
bucketsList.add(sameRangeList);
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
for (Bucket bucket : filters.buckets) {
|
||||
for (InternalBucket bucket : filters.buckets) {
|
||||
bucketsList.get(i++).add(bucket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InternalFilters reduced = new InternalFilters(name, new ArrayList<Bucket>(bucketsList.size()), keyed, pipelineAggregators(), getMetaData());
|
||||
for (List<Bucket> sameRangeList : bucketsList) {
|
||||
InternalFilters reduced = new InternalFilters(name, new ArrayList<InternalBucket>(bucketsList.size()), keyed, pipelineAggregators(), getMetaData());
|
||||
for (List<InternalBucket> sameRangeList : bucketsList) {
|
||||
reduced.buckets.add((sameRangeList.get(0)).reduce(sameRangeList, reduceContext));
|
||||
}
|
||||
return reduced;
|
||||
|
@ -230,9 +230,9 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
protected void doReadFrom(StreamInput in) throws IOException {
|
||||
keyed = in.readBoolean();
|
||||
int size = in.readVInt();
|
||||
List<Bucket> buckets = new ArrayList<>(size);
|
||||
List<InternalBucket> buckets = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
Bucket bucket = new Bucket(keyed);
|
||||
InternalBucket bucket = new InternalBucket(keyed);
|
||||
bucket.readFrom(in);
|
||||
buckets.add(bucket);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
protected void doWriteTo(StreamOutput out) throws IOException {
|
||||
out.writeBoolean(keyed);
|
||||
out.writeVInt(buckets.size());
|
||||
for (Bucket bucket : buckets) {
|
||||
for (InternalBucket bucket : buckets) {
|
||||
bucket.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
} else {
|
||||
builder.startArray(CommonFields.BUCKETS);
|
||||
}
|
||||
for (Bucket bucket : buckets) {
|
||||
for (InternalBucket bucket : buckets) {
|
||||
bucket.toXContent(builder, params);
|
||||
}
|
||||
if (keyed) {
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DerivativePipelineAggregator extends PipelineAggregator {
|
|||
} else if (key instanceof Number) {
|
||||
return ((Number) key).longValue();
|
||||
} else {
|
||||
throw new AggregationExecutionException("Bucket keys must be either a Number or a DateTime for aggregation " + name()
|
||||
throw new AggregationExecutionException("InternalBucket keys must be either a Number or a DateTime for aggregation " + name()
|
||||
+ ". Found bucket with key " + key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class InternalProfileCollector implements Collector {
|
|||
/**
|
||||
* Creates a human-friendly representation of the Collector name.
|
||||
*
|
||||
* Bucket Collectors use the aggregation name in their toString() method,
|
||||
* InternalBucket Collectors use the aggregation name in their toString() method,
|
||||
* which makes the profiled output a bit nicer.
|
||||
*
|
||||
* @param c The Collector to derive a name from
|
||||
|
|
|
@ -1243,7 +1243,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
|||
for (int i = 0; i < buckets.size(); i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
assertThat(bucket, notNullValue());
|
||||
assertThat("Bucket " + i + " had wrong key", (DateTime) bucket.getKey(), equalTo(new DateTime(timeZoneStartToday.getMillis() + (i * 60 * 60 * 1000), DateTimeZone.UTC)));
|
||||
assertThat("InternalBucket " + i + " had wrong key", (DateTime) bucket.getKey(), equalTo(new DateTime(timeZoneStartToday.getMillis() + (i * 60 * 60 * 1000), DateTimeZone.UTC)));
|
||||
if (i == 0 || i == 12) {
|
||||
assertThat(bucket.getDocCount(), equalTo(1l));
|
||||
} else {
|
||||
|
|
|
@ -238,7 +238,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
Bucket bucket = buckets.get(i);
|
||||
assertThat(bucket, notNullValue());
|
||||
assertThat("Bucket " + bucket.getKey() + " has wrong number of documents", bucket.getDocCount(), equalTo(1l));
|
||||
assertThat("InternalBucket " + bucket.getKey() + " has wrong number of documents", bucket.getDocCount(), equalTo(1l));
|
||||
GeoBounds geoBounds = bucket.getAggregations().get(aggName);
|
||||
assertThat(geoBounds, notNullValue());
|
||||
assertThat(geoBounds.getName(), equalTo(aggName));
|
||||
|
|
|
@ -185,7 +185,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < numValueBuckets; ++i) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
SimpleValue docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (i > 0) {
|
||||
assertThat(docCountDeriv, notNullValue());
|
||||
|
@ -224,7 +224,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < numValueBuckets; ++i) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
Derivative docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (i > 0) {
|
||||
assertThat(docCountDeriv, notNullValue());
|
||||
|
@ -267,7 +267,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
// overwritten
|
||||
for (int i = 0; i < numValueBuckets; ++i) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
Sum sum = bucket.getAggregations().get("sum");
|
||||
assertThat(sum, notNullValue());
|
||||
long expectedSum = valueCounts[i] * (i * interval);
|
||||
|
@ -312,7 +312,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
// overwritten
|
||||
for (int i = 0; i < numValueBuckets; ++i) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
Stats stats = bucket.getAggregations().get("stats");
|
||||
assertThat(stats, notNullValue());
|
||||
long expectedSum = valueCounts[i] * (i * interval);
|
||||
|
@ -366,7 +366,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < numValueBuckets; ++i) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]);
|
||||
SimpleValue docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (i > 0) {
|
||||
assertThat(docCountDeriv, notNullValue());
|
||||
|
@ -395,7 +395,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < valueCounts_empty.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
SimpleValue docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (firstDerivValueCounts_empty[i] == null) {
|
||||
assertThat(docCountDeriv, nullValue());
|
||||
|
@ -425,7 +425,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < valueCounts_empty_rnd.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty_rnd[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty_rnd[i]);
|
||||
SimpleValue docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (firstDerivValueCounts_empty_rnd[i] == null) {
|
||||
assertThat(docCountDeriv, nullValue());
|
||||
|
@ -454,7 +454,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < valueCounts_empty.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i + ": ", bucket, i, valueCounts_empty[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i + ": ", bucket, i, valueCounts_empty[i]);
|
||||
SimpleValue docCountDeriv = bucket.getAggregations().get("deriv");
|
||||
if (firstDerivValueCounts_empty[i] == null) {
|
||||
assertThat(docCountDeriv, nullValue());
|
||||
|
@ -484,7 +484,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
double lastSumValue = Double.NaN;
|
||||
for (int i = 0; i < valueCounts_empty.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
Sum sum = bucket.getAggregations().get("sum");
|
||||
double thisSumValue = sum.value();
|
||||
if (bucket.getDocCount() == 0) {
|
||||
|
@ -526,7 +526,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
double lastSumValue = Double.NaN;
|
||||
for (int i = 0; i < valueCounts_empty.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]);
|
||||
Sum sum = bucket.getAggregations().get("sum");
|
||||
double thisSumValue = sum.value();
|
||||
if (bucket.getDocCount() == 0) {
|
||||
|
@ -565,7 +565,7 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
double lastSumValue = Double.NaN;
|
||||
for (int i = 0; i < valueCounts_empty_rnd.length; i++) {
|
||||
Histogram.Bucket bucket = buckets.get(i);
|
||||
checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty_rnd[i]);
|
||||
checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty_rnd[i]);
|
||||
Sum sum = bucket.getAggregations().get("sum");
|
||||
double thisSumValue = sum.value();
|
||||
if (bucket.getDocCount() == 0) {
|
||||
|
|
|
@ -85,7 +85,7 @@ public class S3Repository extends BlobStoreRepository {
|
|||
|
||||
String region = repositorySettings.settings().get("region", settings.get(REPOSITORY_S3.REGION));
|
||||
if (region == null) {
|
||||
// Bucket setting is not set - use global region setting
|
||||
// InternalBucket setting is not set - use global region setting
|
||||
String regionSetting = settings.get(CLOUD_AWS.REGION);
|
||||
if (regionSetting != null) {
|
||||
regionSetting = regionSetting.toLowerCase(Locale.ENGLISH);
|
||||
|
|
Loading…
Reference in New Issue