Skip to content
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

Avoid implicit casting in ESQL SearchStats #104947

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Jan 30, 2024

./gradlew precommit fails with JDK21

SearchStats.java:251: warning: [lossy-conversions] implicit cast from long to int in compound assignment is possibly lossy
                            count += points.size();
                                                ^
SearchStats.java:256: warning: [lossy-conversions] implicit cast from long to int in compound assignment is possibly lossy
                            count += terms.getSumTotalTermFreq();

I think we should use longs instead of ints.

@dnhatn dnhatn requested a review from costin January 30, 2024 18:28
@dnhatn dnhatn added the auto-backport-and-merge Automatically create backport pull requests and merge when ready label Jan 30, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 30, 2024
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

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

LGTM - the result of this function is immediately cast back to long, so this avoids 2 unnecessary casts, in fact (one of which can be lossy).

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@dnhatn
Copy link
Member Author

dnhatn commented Jan 31, 2024

@alex-spies @martijnvg Thanks for reviews.

@dnhatn dnhatn merged commit c8c16a5 into elastic:main Jan 31, 2024
15 checks passed
@dnhatn dnhatn deleted the fix-jdk21 branch January 31, 2024 15:14
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.12

dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Jan 31, 2024
./gradlew precommit fails with JDK21 and we should use longs instead of ints.
elasticsearchmachine pushed a commit that referenced this pull request Jan 31, 2024
./gradlew precommit fails with JDK21 and we should use longs instead of ints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport-and-merge Automatically create backport pull requests and merge when ready >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants