mihaibudiu commented on code in PR #4707:
URL: https://github.com/apache/calcite/pull/4707#discussion_r2648539722
##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java:
##########
@@ -115,11 +117,10 @@ public Double getMaxRowCount(Sort rel, RelMetadataQuery
mq) {
rowCount = Double.POSITIVE_INFINITY;
}
- final long offset = rel.offset instanceof RexLiteral ?
RexLiteral.longValue(rel.offset) : 0;
+ final double offset = literalNumericValue(rel.offset, 0D);
Review Comment:
A large long value cannot be represented exactly as a double, since doubles
have only 53 bits of mantissa.
In particular, very large integer values that differ may have the same
representation as doubles.
Does this change the semantics of this code?
BigDecimal should be completely safe.
--
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]