mihaibudiu commented on code in PR #3917:
URL: https://github.com/apache/calcite/pull/3917#discussion_r1720126405
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java:
##########
@@ -505,9 +505,9 @@ private Expression getConvertExpression(
case SMALLINT: {
if (SqlTypeName.NUMERIC_TYPES.contains(sourceType.getSqlTypeName())) {
return Expressions.call(
- BuiltInMethod.INTEGER_CAST.method,
+ BuiltInMethod.INTEGER_CAST_ROUNDING_MODE.method,
Review Comment:
this should apply to casts from decimal to decimal above
##########
core/src/main/java/org/apache/calcite/util/BuiltInMethod.java:
##########
@@ -315,6 +316,8 @@ public enum BuiltInMethod {
FP_DECIMAL_CAST(Primitive.class, "fpDecimalCast",
Number.class, int.class, int.class),
INTEGER_CAST(Primitive.class, "integerCast", Primitive.class, Object.class),
+ INTEGER_CAST_ROUNDING_MODE(Primitive.class, "integerCast",
Review Comment:
The other cast method should probably be removed.
but many other cast methods have to be considered, including DECIMAL to
DECIMAL, FP to integer, FP to decimal, DECIMAL to FP and perhaps even string to
decimal
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlAbstractConformance.java:
##########
@@ -144,4 +146,8 @@ public abstract class SqlAbstractConformance implements
SqlConformance {
@Override public boolean allowLenientCoercion() {
return SqlConformanceEnum.DEFAULT.allowLenientCoercion();
}
+
+ @Override public RoundingMode roundingMode() {
+ return SqlConformanceEnum.DEFAULT.roundingMode();
Review Comment:
I think rounding should be part of the type system
--
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]