-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Optimize geogrid aggregations for singleton points (#87290)"
This reverts commit 30406ba.
- Loading branch information
Showing
8 changed files
with
163 additions
and
345 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/CellValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
package org.elasticsearch.search.aggregations.bucket.geogrid; | ||
|
||
import org.elasticsearch.index.fielddata.AbstractSortingNumericDocValues; | ||
import org.elasticsearch.index.fielddata.MultiGeoPointValues; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Class representing the long-encoded grid-cells belonging to | ||
* the geo-doc-values. Class must encode the values and then | ||
* sort them in order to account for the cells correctly. | ||
*/ | ||
public abstract class CellValues extends AbstractSortingNumericDocValues { | ||
private MultiGeoPointValues geoValues; | ||
protected int precision; | ||
|
||
protected CellValues(MultiGeoPointValues geoValues, int precision) { | ||
this.geoValues = geoValues; | ||
this.precision = precision; | ||
} | ||
|
||
@Override | ||
public boolean advanceExact(int docId) throws IOException { | ||
if (geoValues.advanceExact(docId)) { | ||
int docValueCount = geoValues.docValueCount(); | ||
resize(docValueCount); | ||
int j = 0; | ||
for (int i = 0; i < docValueCount; i++) { | ||
j = advanceValue(geoValues.nextValue(), j); | ||
} | ||
resize(j); | ||
sort(); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
/** | ||
* Sets the appropriate long-encoded value for <code>target</code> | ||
* in <code>values</code>. | ||
* | ||
* @param target the geo-value to encode | ||
* @param valuesIdx the index into <code>values</code> to set | ||
* @return valuesIdx + 1 if value was set, valuesIdx otherwise. | ||
*/ | ||
protected abstract int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.