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

Rollback switch expressions in the SQL plugin #82349

Merged

Conversation

arteam
Copy link
Contributor

@arteam arteam commented Jan 10, 2022

The plugin's source compatibility was updated to Java 8 in #82274, so switch expressions are not supported anymore.

See #82178

It was updated to Java 8 compatibility in elastic#82274
@arteam arteam added the :Core/Infra/Core Core issues without another label label Jan 10, 2022
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jan 10, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@arteam arteam changed the title Rollback switch expressions for the SQL plugin Rollback switch expressions in the SQL plugin Jan 10, 2022
case HALF_FLOAT:
case SCALED_FLOAT:
case DOUBLE:
return Boolean.valueOf(Integer.signum(((Number) val).intValue()) != 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be reverted to it's original Boolean.valueOf(((Number) val).doubleValue() != 0), as it yields incorrect results for non-zero floats in (-1, 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, it had been set to return Boolean.valueOf(Integer.signum(((Number) val).intValue()) != 0), before I started working on switch expression refactoring. Maybe it was changed at some point before the switch expression change?

@arteam arteam merged commit 78509f4 into elastic:master Jan 10, 2022
@arteam arteam deleted the rollback-switch-expressions-for-sql-module branch January 10, 2022 10:14
arteam added a commit to arteam/elasticsearch that referenced this pull request Jan 10, 2022
It was updated to Java 8 compatibility in elastic#82274

(cherry picked from commit 78509f4)
arteam added a commit that referenced this pull request Jan 10, 2022
JEP 361[https://openjdk.java.net/jeps/361] added support for switch expressions
which can be much more terse and less error-prone than switch statements.

Another useful feature of switch expressions is exhaustiveness: we can make
sure that an enum switch expression covers all the cases at compile time.

(cherry picked from commit 0699c93)

* Rollback switch expressions for the SQL plugin (#82349)

It was updated to Java 8 compatibility in #82274

(cherry picked from commit 78509f4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants