elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.51k stars 24.6k forks source link

Aggregator result equality easy to break #111757

Open nik9000 opened 1 month ago

nik9000 commented 1 month ago

Description

We'd like to make some optimizations that are gated behind the equals method on subclasses of InternalAggregation working perfectly. But at the moment it's quite easy implement equals incorrectly - our default equals implementation checks a few things but doesn't force subclasses to override it with their extra data. Many do, but not all. We should make not overriding equals here a compile time failure. Generally we do this by adding an abstract boolean doEquals method and calling it in equals. That's a bit tricky here because of all the layers of subclasses, but we can do it.

elasticsearchmachine commented 1 month ago

Pinging @elastic/es-analytical-engine (Team:Analytics)