-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Rollback switch expressions in the SQL plugin #82349
Conversation
It was updated to Java 8 compatibility in elastic#82274
Pinging @elastic/es-core-infra (Team:Core/Infra) |
case HALF_FLOAT: | ||
case SCALED_FLOAT: | ||
case DOUBLE: | ||
return Boolean.valueOf(Integer.signum(((Number) val).intValue()) != 0); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
It was updated to Java 8 compatibility in elastic#82274 (cherry picked from commit 78509f4)
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)
The plugin's source compatibility was updated to Java 8 in #82274, so switch expressions are not supported anymore.
See #82178