elastic / elasticsearch

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

Aggregator result equality easy to break #111757

Open nik9000 opened 3 months ago

nik9000 commented 3 months 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 3 months ago

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