Skip to content

Conversation

@craigtaverner
Copy link
Contributor

@craigtaverner craigtaverner commented Nov 3, 2022

Fixes #90157

@craigtaverner craigtaverner added >enhancement :Analytics/Geo Indexing, search aggregations of geo points and shapes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Nov 3, 2022
@craigtaverner craigtaverner requested a review from iverase November 3, 2022 20:38
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

Hi @craigtaverner, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

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
Copy link
Contributor

@iverase iverase left a 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:

  1. 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.

* the provided decoder (could be geo or cartesian)
*/
protected abstract static class ShapeValue implements ToXContentFragment {
public abstract static class ShapeValue implements ToXContentFragment {
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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();
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

assertSearchResponse(response);

GeoBounds geoBounds = response.getAggregations().get(aggName);
SpatialBounds<GeoPoint> geoBounds = response.getAggregations().get(aggName);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

assertThat(global.getAggregations().asMap().size(), equalTo(1));

GeoBounds geobounds = global.getAggregations().get(aggName);
SpatialBounds<GeoPoint> geobounds = global.getAggregations().get(aggName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here

Copy link
Contributor Author

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.

assertSearchResponse(response);

GeoBounds geoBounds = response.getAggregations().get(aggName);
SpatialBounds<GeoPoint> geoBounds = response.getAggregations().get(aggName);
Copy link
Contributor

@iverase iverase Nov 10, 2022

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?
)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Removed the comment.

@craigtaverner craigtaverner force-pushed the cartesian_aggs_boundingbox branch from 51b1b06 to ee930e6 Compare November 10, 2022 18:10
Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@craigtaverner craigtaverner merged commit 34e8da6 into elastic:main Nov 14, 2022
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Nov 15, 2022
* 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
@elasticsearchmachine
Copy link
Collaborator

@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:

  • The PR is labelled release highlight but the changelog has no highlight section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Geo Indexing, search aggregations of geo points and shapes >enhancement release highlight Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.6.0

3 participants