tindzk commented on code in PR #3687: URL: https://github.com/apache/calcite/pull/3687#discussion_r1507319896
########## core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java: ########## @@ -1374,11 +1375,24 @@ private Result toInnerStorageType(Result result, Type storageType) { } final Type storageType = currentStorageType != null ? currentStorageType : typeFactory.getJavaClass(dynamicParam.getType()); - final Expression valueExpression = + + final boolean isNumeric = SqlTypeFamily.NUMERIC.contains(dynamicParam.getType()); + + // For numeric types, use java.lang.Number to prevent cast exception + // when the parameter type differs from the target type + Expression argumentExpression = EnumUtils.convert( Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, Expressions.constant("?" + dynamicParam.getIndex())), - storageType); + isNumeric ? java.lang.Number.class : storageType); + + // The cast operation will fail for null values Review Comment: I clarified the comment. -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org