julianhyde commented on code in PR #4537:
URL: https://github.com/apache/calcite/pull/4537#discussion_r2350484405
##########
core/src/main/java/org/apache/calcite/rex/RexLiteral.java:
##########
@@ -1290,6 +1291,14 @@ public static long longValue(RexNode node) {
return number.longValue();
}
+ /** Returns the value of a literal, cast, or unary minus, as a BigDecimal;
+ * never null. Uses {@link BigDecimal} for consistency with numeric literals
+ * and to facilitate precise comparison operations.*/
+ public static BigDecimal roundedValue(RexNode node) {
Review Comment:
Good point that you can't compare any Number with BigDecimal.
But I think its best if the APIs (e.g. `getRowCountThreshold`) just use
`Number`. When you need to compare it, use `SqlFunctions.toBigDecimal(Number)`
to convert that number to a `BigDecimal`.
I'm not sure there's any need to round the number up or down to an integer.
Just compare it with 0, 1 or whatever.
--
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]