alex-plekhanov commented on code in PR #11644:
URL: https://github.com/apache/ignite/pull/11644#discussion_r1830016716
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteMath.java:
##########
@@ -252,9 +252,11 @@ public static long convertToLongExact(Number x) {
/** Cast value to {@code long}, throwing an exception if the result
overflows an {@code long}. */
public static long convertToLongExact(double x) {
- checkNumberLongBounds(BIGINT, x = round(x));
+ Number res = round(convertToBigDecimal(x));
Review Comment:
Why do we need additional convertation to big decimal now? I think we can do
this convertation using double
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteMath.java:
##########
@@ -269,7 +271,12 @@ public static int convertToIntExact(long x) {
/** Cast value to {@code int}, throwing an exception if the result
overflows an {@code int}. */
public static int convertToIntExact(double x) {
- return convertToIntExact((long)round(x));
+ x = extendToRound(x);
+
+ if (x <= Integer.MIN_VALUE || x >= Integer.MAX_VALUE)
Review Comment:
Here we need Integer.MIN_VALUE - 1d and Integer.MAX_VALUE + 1d
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]