Skip to content

Commit f18823a

Browse files
bck
1 parent 2b410c4 commit f18823a

File tree

8 files changed

+13
-36
lines changed

8 files changed

+13
-36
lines changed

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/BytesKeyedBucketOrds.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,6 @@ public interface BucketOrdsEnum {
7575
* Read the current value.
7676
*/
7777
void readValue(BytesRef dest);
78-
79-
/**
80-
* An {@linkplain BucketOrdsEnum} that is empty.
81-
*/
82-
BucketOrdsEnum EMPTY = new BucketOrdsEnum() {
83-
@Override
84-
public boolean next() {
85-
return false;
86-
}
87-
88-
@Override
89-
public long ord() {
90-
return 0;
91-
}
92-
93-
@Override
94-
public void readValue(BytesRef dest) {}
95-
};
9678
}
9779

9880
/**

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ static class LowCardinality extends GlobalOrdinalsStringTermsAggregator {
290290
BucketCountThresholds bucketCountThresholds,
291291
AggregationContext context,
292292
Aggregator parent,
293-
boolean remapGlobalOrds,
294293
SubAggCollectionMode collectionMode,
295294
boolean showTermDocCountError,
296295
Map<String, Object> metadata,
@@ -308,7 +307,7 @@ static class LowCardinality extends GlobalOrdinalsStringTermsAggregator {
308307
ALWAYS_TRUE,
309308
context,
310309
parent,
311-
remapGlobalOrds,
310+
false,
312311
collectionMode,
313312
showTermDocCountError,
314313
CardinalityUpperBound.ONE,
@@ -385,7 +384,7 @@ protected void doClose() {
385384
Releasables.close(resultStrategy, segmentDocCounts, collectionStrategy);
386385
}
387386

388-
private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) throws IOException {
387+
private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) {
389388
for (long i = 1; i < segmentDocCounts.size(); i++) {
390389
// We use set(...) here, because we need to reset the slow to 0.
391390
// segmentDocCounts get reused over the segments and otherwise counts would be too high.
@@ -395,7 +394,7 @@ private void mapSegmentCountsToGlobalCounts(LongUnaryOperator mapping) throws IO
395394
}
396395
long ord = i - 1; // remember we do +1 when counting
397396
long globalOrd = mapping.applyAsLong(ord);
398-
incrementBucketDocCount(collectionStrategy.globalOrdToBucketOrd(0, globalOrd), inc);
397+
incrementBucketDocCount(collectionStrategy.globalOrdToBucketOrd(globalOrd), inc);
399398
}
400399
}
401400
}
@@ -440,7 +439,7 @@ abstract static class CollectionStrategy implements Releasable {
440439
/**
441440
* Convert a global ordinal into a bucket ordinal.
442441
*/
443-
abstract long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd);
442+
abstract long globalOrdToBucketOrd(long globalOrd);
444443

445444
/**
446445
* Create the aggregation result
@@ -491,8 +490,7 @@ void collectGlobalOrd(long owningBucketOrd, int doc, long globalOrd, LeafBucketC
491490
}
492491

493492
@Override
494-
long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd) {
495-
assert owningBucketOrd == 0;
493+
long globalOrdToBucketOrd(long globalOrd) {
496494
return globalOrd;
497495
}
498496

@@ -659,8 +657,8 @@ void collectGlobalOrd(long owningBucketOrd, int doc, long globalOrd, LeafBucketC
659657
}
660658

661659
@Override
662-
long globalOrdToBucketOrd(long owningBucketOrd, long globalOrd) {
663-
return bucketOrds.find(owningBucketOrd, globalOrd);
660+
long globalOrdToBucketOrd(long globalOrd) {
661+
return bucketOrds.find(0, globalOrd);
664662
}
665663

666664
private void collectZeroDocEntriesIfNeeded(long owningBucketOrd) throws IOException {
@@ -789,7 +787,7 @@ InternalAggregation[] buildAggregations(LongArray owningBucketOrds) throws IOExc
789787
/**
790788
* Strategy for building results.
791789
*/
792-
abstract class ResultStrategy<
790+
abstract static class ResultStrategy<
793791
R extends InternalAggregation,
794792
B extends InternalMultiBucketAggregation.InternalBucket,
795793
TB extends InternalMultiBucketAggregation.InternalBucket> implements Releasable {

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalSignificantTerms.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected Bucket(long subsetDf, long supersetDf, InternalAggregations aggregatio
7272
/**
7373
* Read from a stream.
7474
*/
75-
protected Bucket(StreamInput in, DocValueFormat format) {
75+
protected Bucket(DocValueFormat format) {
7676
this.format = format;
7777
}
7878

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificanceLookup.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ interface BackgroundFrequencyForLong extends Releasable {
8989
this.backgroundFilter = null;
9090
}
9191
} else {
92-
Query contextFiltered = context.filterQuery(backgroundQuery);
93-
this.backgroundFilter = contextFiltered;
92+
this.backgroundFilter = context.filterQuery(backgroundQuery);
9493
}
9594
/*
9695
* We need to use a superset size that includes deleted docs or we

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantLongTerms.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Bucket(long subsetDf, long supersetDf, long term, InternalAggregations ag
3737
}
3838

3939
Bucket(StreamInput in, DocValueFormat format) throws IOException {
40-
super(in, format);
40+
super(format);
4141
subsetDf = in.readVLong();
4242
supersetDf = in.readVLong();
4343
term = in.readLong();

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantStringTerms.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Bucket(
4848
* Read from a stream.
4949
*/
5050
public Bucket(StreamInput in, DocValueFormat format) throws IOException {
51-
super(in, format);
51+
super(format);
5252
termBytes = in.readBytesRef();
5353
subsetDf = in.readVLong();
5454
supersetDf = in.readVLong();

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,6 @@ Aggregator create(
511511
bucketCountThresholds,
512512
context,
513513
parent,
514-
false,
515514
subAggCollectMode,
516515
showTermDocCountError,
517516
metadata,

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedSignificantTerms.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
package org.elasticsearch.search.aggregations.bucket.terms;
1010

11-
import org.apache.lucene.util.BytesRef;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
1413
import org.elasticsearch.search.DocValueFormat;
@@ -40,7 +39,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
4039
* {@linkplain UnmappedTerms} doesn't ever need to build it because it never returns any buckets.
4140
*/
4241
protected abstract static class Bucket extends InternalSignificantTerms.Bucket<Bucket> {
43-
private Bucket(BytesRef term, long subsetDf, long supersetDf, InternalAggregations aggregations, DocValueFormat format) {
42+
private Bucket(long subsetDf, long supersetDf, InternalAggregations aggregations, DocValueFormat format) {
4443
super(subsetDf, supersetDf, aggregations, format);
4544
}
4645
}

0 commit comments

Comments
 (0)