Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change visibility of GeoGrid base class and method from package private to protected #81643

Merged
merged 3 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* the geo-doc-values. Class must encode the values and then
* sort them in order to account for the cells correctly.
*/
abstract class CellValues extends AbstractSortingNumericDocValues {
public abstract class CellValues extends AbstractSortingNumericDocValues {
private MultiGeoPointValues geoValues;
protected int precision;

Expand Down Expand Up @@ -51,5 +51,5 @@ public boolean advanceExact(int docId) throws IOException {
* @param valuesIdx the index into <code>values</code> to set
* @return valuesIdx + 1 if value was set, valuesIdx otherwise.
*/
abstract int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx);
protected abstract int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid<?>> extends Bu
protected final ValuesSource.Numeric valuesSource;
protected final LongKeyedBucketOrds bucketOrds;

GeoGridAggregator(
protected GeoGridAggregator(
String name,
AggregatorFactories factories,
ValuesSource.Numeric valuesSource,
Expand Down Expand Up @@ -92,14 +92,14 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
};
}

abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
protected abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);

/**
* This method is used to return a re-usable instance of the bucket when building
* the aggregation.
* @return a new {@link InternalGeoGridBucket} implementation with empty parameters
*/
abstract InternalGeoGridBucket newEmptyBucket();
protected abstract InternalGeoGridBucket newEmptyBucket();

@Override
public InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static class UnboundedCellValues extends CellValues {
}

@Override
int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
values[valuesIdx] = Geohash.longEncode(target.getLon(), target.getLat(), precision);
return valuesIdx + 1;
}
Expand All @@ -83,7 +83,7 @@ private static class BoundedCellValues extends CellValues {
}

@Override
int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
final String hash = Geohash.stringEncode(target.getLon(), target.getLat(), precision);
if (validHash(hash)) {
values[valuesIdx] = Geohash.longEncode(hash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public GeoHashGridAggregator(
}

@Override
InternalGeoHashGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
protected InternalGeoHashGrid buildAggregation(
String name,
int requiredSize,
List<InternalGeoGridBucket> buckets,
Map<String, Object> metadata
) {
return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
}

Expand All @@ -47,7 +52,7 @@ public InternalGeoHashGrid buildEmptyAggregation() {
return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), metadata());
}

InternalGeoGridBucket newEmptyBucket() {
protected InternalGeoGridBucket newEmptyBucket() {
return new InternalGeoHashGridBucket(0, 0, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static class UnboundedCellValues extends CellValues {
}

@Override
int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
values[valuesIdx] = GeoTileUtils.longEncode(target.getLon(), target.getLat(), precision);
return valuesIdx + 1;
}
Expand Down Expand Up @@ -97,7 +97,7 @@ protected BoundedCellValues(MultiGeoPointValues geoValues, int precision, GeoBou
}

@Override
int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
final int x = GeoTileUtils.getXTile(target.getLon(), this.tiles);
final int y = GeoTileUtils.getYTile(target.getLat(), this.tiles);
if (validTile(x, y)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ public GeoTileGridAggregator(
}

@Override
InternalGeoTileGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
protected InternalGeoTileGrid buildAggregation(
String name,
int requiredSize,
List<InternalGeoGridBucket> buckets,
Map<String, Object> metadata
) {
return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
}

Expand All @@ -48,7 +53,7 @@ public InternalGeoTileGrid buildEmptyAggregation() {
return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata());
}

InternalGeoGridBucket newEmptyBucket() {
protected InternalGeoGridBucket newEmptyBucket() {
return new InternalGeoTileGridBucket(0, 0, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket> extends I
protected final int requiredSize;
protected final List<InternalGeoGridBucket> buckets;

InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
protected InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
super(name, metadata);
this.requiredSize = requiredSize;
this.buckets = buckets;
}

abstract Writeable.Reader<B> getBucketReader();
protected abstract Writeable.Reader<B> getBucketReader();

/**
* Read from a stream.
Expand All @@ -62,7 +62,12 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeList(buckets);
}

abstract InternalGeoGrid<B> create(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
protected abstract InternalGeoGrid<B> create(
String name,
int requiredSize,
List<InternalGeoGridBucket> buckets,
Map<String, Object> metadata
);

@Override
public List<InternalGeoGridBucket> getBuckets() {
Expand Down Expand Up @@ -117,7 +122,7 @@ protected InternalGeoGridBucket reduceBucket(List<InternalGeoGridBucket> buckets
return createBucket(buckets.get(0).hashAsLong, docCount, aggs);
}

abstract B createBucket(long hashAsLong, long docCount, InternalAggregations aggregations);
protected abstract B createBucket(long hashAsLong, long docCount, InternalAggregations aggregations);

@Override
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void writeTo(StreamOutput out) throws IOException {
aggregations.writeTo(out);
}

long hashAsLong() {
protected long hashAsLong() {
return hashAsLong;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public InternalGeoGridBucket createBucket(InternalAggregations aggregations, Int
}

@Override
InternalGeoGrid<InternalGeoHashGridBucket> create(
protected InternalGeoGrid<InternalGeoHashGridBucket> create(
String name,
int requiredSize,
List<InternalGeoGridBucket> buckets,
Expand All @@ -50,12 +50,12 @@ InternalGeoGrid<InternalGeoHashGridBucket> create(
}

@Override
InternalGeoHashGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
protected InternalGeoHashGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
return new InternalGeoHashGridBucket(hashAsLong, docCount, aggregations);
}

@Override
Reader<InternalGeoHashGridBucket> getBucketReader() {
protected Reader<InternalGeoHashGridBucket> getBucketReader() {
return InternalGeoHashGridBucket::new;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public InternalGeoGridBucket createBucket(InternalAggregations aggregations, Int
}

@Override
InternalGeoGrid<InternalGeoTileGridBucket> create(
protected InternalGeoGrid<InternalGeoTileGridBucket> create(
String name,
int requiredSize,
List<InternalGeoGridBucket> buckets,
Expand All @@ -50,12 +50,12 @@ InternalGeoGrid<InternalGeoTileGridBucket> create(
}

@Override
InternalGeoTileGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
protected InternalGeoTileGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
return new InternalGeoTileGridBucket(hashAsLong, docCount, aggregations);
}

@Override
Reader<InternalGeoTileGridBucket> getBucketReader() {
protected Reader<InternalGeoTileGridBucket> getBucketReader() {
return InternalGeoTileGridBucket::new;
}

Expand Down