nastra commented on code in PR #5928:
URL: https://github.com/apache/iceberg/pull/5928#discussion_r989048785
##########
api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java:
##########
@@ -291,7 +291,9 @@ private static String sanitize(Literal<?> literal) {
}
private static String sanitizeNumber(Number value, String type) {
- int numDigits = (int) Math.log10(value.doubleValue()) + 1;
+ // log10 of zero isn't defined and will result in negative infinity
+ int numDigits =
+ 0.0d == value.doubleValue() ? 1 : (int)
Math.log10(Math.abs(value.doubleValue())) + 1;
Review Comment:
for `Double.MIN_VALUE` we'll get something like `(-322-digit-float)` because
`Math.log10` produces a negative result. Not sure how much we care about
`Double.MIN_VALUE`/`Float.MIN_VALUE` but we're not producing correct results
for them
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]