Skip to content

Remove needless array indirection in AbstractInternalTerms #126830

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

Conversation

original-brownbear
Copy link
Member

Randomly found small win :)

Obviously just a single count, make it a plain field like the counter next to it.

Obviously just a single count, make it a plain field like the counter next to it.
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Apr 15, 2025
@elasticsearchmachine
Copy link
Collaborator

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

}
});
} else if (reduceContext.isFinalReduce()) {
TopBucketBuilder<B> top = TopBucketBuilder.build(
getRequiredSize(),
getOrder(),
removed -> otherDocCount[0] += removed.getDocCount(),
removed -> otherDocCount += removed.getDocCount(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought you cannot use mutable variables like that in lambda functions.

Copy link
Member Author

Choose a reason for hiding this comment

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

You can if they are a field on an object, just not mutable locals :)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@original-brownbear original-brownbear added the auto-backport Automatically create backport pull requests when merged label Apr 15, 2025
@original-brownbear
Copy link
Member Author

Thanks you two!

@original-brownbear original-brownbear merged commit d71ada6 into elastic:main Apr 15, 2025
17 checks passed
@original-brownbear original-brownbear deleted the needless-array-abstract-internal-terms branch April 15, 2025 11:53
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Apr 15, 2025
…26830)

Obviously just a single count, make it a plain field like the counter next to it.
elasticsearchmachine pushed a commit that referenced this pull request Apr 15, 2025
…126839)

Obviously just a single count, make it a plain field like the counter next to it.
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Apr 16, 2025
…26830)

Obviously just a single count, make it a plain field like the counter next to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations auto-backport Automatically create backport pull requests when merged >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants