Skip to content

Introduce a new aggregation module#90294

Merged
martijnvg merged 16 commits intoelastic:mainfrom
martijnvg:introduce_aggregations_module
Sep 30, 2022
Merged

Introduce a new aggregation module#90294
martijnvg merged 16 commits intoelastic:mainfrom
martijnvg:introduce_aggregations_module

Conversation

@martijnvg
Copy link
Copy Markdown
Member

@martijnvg martijnvg commented Sep 23, 2022

Also this PR moves the adjacency_matrix to this new module.
This serves as an example how to move the other aggregations from the server module into this new module for aggregations.

The new module name is aggregations.
The new module will use the org.elasticsearch.aggregations.bucket package for all bucket aggregations. (org.elasticsearch.search.aggregations.bucket is already taken by server module).
We can change the naming as part of reviewing this PR.

Relates to #90283

and moves the `adjacency_matrix` to this new module.

The new module name is `aggregations`.
The new module will use the `org.elasticsearch.aggregations.bucket` package for all bucket aggregations. (`org.elasticsearch.searcg.aggregations.bucket` is already taken by server module).

Relates to elastic#90283
@martijnvg
Copy link
Copy Markdown
Member Author

Opening this PR as draft in order for this change to pass PR CI. Probably some issues will occur, that I didn't foresee locally.

@@ -138,7 +137,6 @@ public class AggregationsTests extends ESTestCase {
new InternalDateRangeTests(),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we want this test also in the new module? As we move over aggregations we remove entries here and add it to the equivalent test case in aggregations module?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do we think this should look in the end? Would there be an AggregationsTests in test:framework that has no aggs listed? That feels maybe not great. But neither does having test:framework depend on the module. Maybe it'd make sense to move this class to a aggregations:test module that other aggregation extensions depend on. That'd pick up all these tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But in the short term removing this from the list is fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe it'd make sense to move this class to a aggregations:test module that other aggregation extensions depend on. That'd pick up all these tests.

Yes, I think when enough tests (50%?) have moved we should move this test to the aggregation module.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@martijnvg martijnvg changed the title Introduces a new aggregation module Introduce a new aggregation module Sep 23, 2022
@martijnvg martijnvg marked this pull request as ready for review September 26, 2022 07:04
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 26, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

requires org.elasticsearch.base;
requires org.elasticsearch.server;
requires org.elasticsearch.xcontent;
requires org.apache.logging.log4j;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might should just use ES's logging directly while we're moving.

}

public static boolean hasValue(InternalAdjacencyMatrix agg) {
public static boolean hasValue(MultiBucketsAggregation agg) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've never really understood the point of this method. It seems like we could assert this in the tests if we wanted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, this is used in tests (GeoGridAggregatorTestCase) and sql (MetricAggExtractor). I think this should be moved to sql (looks like the biggest user of this class?) and the one usage in GeoGridAggregatorTestCase can be replaced with adding a helper method that does agg.getBuckets().stream().anyMatch(bucket -> bucket.getDocCount() > 0).

Let's do this in a followup change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@@ -138,7 +137,6 @@ public class AggregationsTests extends ESTestCase {
new InternalDateRangeTests(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do we think this should look in the end? Would there be an AggregationsTests in test:framework that has no aggs listed? That feels maybe not great. But neither does having test:framework depend on the module. Maybe it'd make sense to move this class to a aggregations:test module that other aggregation extensions depend on. That'd pick up all these tests.

@@ -138,7 +137,6 @@ public class AggregationsTests extends ESTestCase {
new InternalDateRangeTests(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But in the short term removing this from the list is fine.

@martijnvg martijnvg requested a review from nik9000 September 27, 2022 07:28

testClusters.configureEach {
module ':modules:mapper-extras'
module ':modules:aggregations'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be "temporary" - as in, when we've moved the rest of the aggs it should be removed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added comment to remind us: 71a3530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants