-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Support cartesian_bounds aggregation on point and shape #91298
Support cartesian_bounds aggregation on point and shape #91298
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Hi @craigtaverner, I've created a changelog YAML for you. |
Hi @craigtaverner, I've updated the changelog YAML for you. |
And added new CartesianBoundsIT and CartesianCentroidIT
* Removing the neg/pos left/right split used in bounds because this is only relevant to GeoBounds * Revert GeoBounds to no longer share common code with CartesianBounds (including aggregators) * Make Point and Shape aggregators share common code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor comments specially for the visibility of Shapes.ShapeValue
.
Two things:
- You have some weird file named
jffi4926421121997545579.dylib
which seems some left over.
2) We need to check if it is ok to change the API of GeoBounds, not sure if that is an. API we cannot change in a minor.
I check things again and everything is clear.
@@ -88,7 +90,7 @@ public T missing(String missing) { | |||
* thin wrapper around a {@link GeometryDocValueReader} which encodes / decodes values using | |||
* the provided decoder (could be geo or cartesian) | |||
*/ | |||
protected abstract static class ShapeValue implements ToXContentFragment { | |||
public abstract static class ShapeValue implements ToXContentFragment { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it protected again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. My recent refactoring to remove the dateline logic from cartesian removed the need for this, so that was a good catch, thanks!
@Override | ||
public Version getMinimalSupportedVersion() { | ||
// TODO: Should we have a version here? We only release this for 8.5 or 8.6 | ||
return Version.V_EMPTY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be add 8.6 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that none of the other aggregations had values set here, even when recently added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I spoke too soon, while the first 4 I looked at did not specify anything, a more careful analysis shows that 4 of the 13 known Geo aggregations did have settings:
GeoHexGridAggregationBuilder
->Version.V_8_1_0
GeoLineAggregationBuilder
->Version.V_7_11_0
GeoGridQueryBuilder
->Version.V_8_3_0
GeoTileGridAggregationBuilder
->Version.V_7_0_0
So I will add Version.V_8_6_0
to the current one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also added it to the centroid aggregation, which was missing too!
public void collect(int doc, long bucket) throws IOException { | ||
if (values.advanceExact(doc)) { | ||
maybeResize(bucket); | ||
ShapeValues.ShapeValue value = values.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let use here CartesianShapeValues.CartesianShapeValue
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -43,15 +44,15 @@ public void testSingleValuedField() throws Exception { | |||
|
|||
assertSearchResponse(response); | |||
|
|||
GeoBounds geoBounds = response.getAggregations().get(aggName); | |||
SpatialBounds<GeoPoint> geoBounds = response.getAggregations().get(aggName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be use here GeoBounds instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was in the process of refactoring. I'll finish the job and then you can decide.
@@ -69,25 +70,28 @@ public void testSingleValuedField_getProperty() throws Exception { | |||
assertThat(global.getAggregations(), notNullValue()); | |||
assertThat(global.getAggregations().asMap().size(), equalTo(1)); | |||
|
|||
GeoBounds geobounds = global.getAggregations().get(aggName); | |||
SpatialBounds<GeoPoint> geobounds = global.getAggregations().get(aggName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this for the two dateline tests, but all the rest moved into shared code.
@@ -98,15 +102,15 @@ public void testMultiValuedField() throws Exception { | |||
|
|||
assertSearchResponse(response); | |||
|
|||
GeoBounds geoBounds = response.getAggregations().get(aggName); | |||
SpatialBounds<GeoPoint> geoBounds = response.getAggregations().get(aggName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here, and every place where we know the concrete class
An earlier commit started generalizing Geo/Cartesian integration tests for centroid and bounds aggregations, but did not complete the job. This commit completes the work, since almost all tests are identical between cartesian and geo, except tests related to the dateline.
usage.track( | ||
SpatialStatsAction.Item.CARTESIANBOUNDS, | ||
CartesianBoundsAggregationBuilder.PARSER // TODO: Should we have a license for this? | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, license for CartesianBounds should be the same as for GeoBounds, so it is basic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Removed the comment.
51b1b06
to
ee930e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* main: (163 commits) [DOCS] Edits frequent items aggregation (elastic#91564) Handle providers of optional services in ubermodule classloader (elastic#91217) Add `exportDockerImages` lifecycle task for exporting docker tarballs (elastic#91571) Fix CSV dependency report output file location in DRA CI job Fix variable placeholder for Strings.format calls (elastic#91531) Fix output dir creation in ConcatFileTask (elastic#91568) Fix declaration of dependencies in DRA snapshots CI job (elastic#91569) Upgrade Gradle Enterprise plugin to 3.11.4 (elastic#91435) Ingest DateProcessor (small) speedup, optimize collections code in DateFormatter.forPattern (elastic#91521) Fix inter project handling of generateDependenciesReport (elastic#91555) [Synthetics] Add synthetics-* read to fleet-server (elastic#91391) [ML] Copy more settings when creating DF analytics destination index (elastic#91546) Reduce CartesianCentroidIT flakiness (elastic#91553) Propagate last node to reinitialized routing tables (elastic#91549) Forecast write load during rollovers (elastic#91425) [DOCS] Warn about potential overhead of named queries (elastic#91512) Datastream unavailable exception metadata (elastic#91461) Generate docker images and dependency report in DRA ci job (elastic#91545) Support cartesian_bounds aggregation on point and shape (elastic#91298) Add support for EQL samples queries (elastic#91312) ... # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java
@craigtaverner according to this PR's labels, I need to update the changelog YAML, but I can't because the PR is closed. Please either update the changelog yourself on the appropriate branch, or adjust the labels. Specifically:
|
Fixes #90157