OS-veracardoso commented on code in PR #1299:
URL: https://github.com/apache/calcite/pull/1299#discussion_r1048238523
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java:
##########
@@ -727,11 +736,38 @@ private Expression translateParameter(RexDynamicParam
expr,
if (storageType == null) {
storageType = typeFactory.getJavaClass(expr.getType());
}
- return nullAs.handle(
- convert(
- Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method,
- Expressions.constant("?" + expr.getIndex())),
- storageType));
+
+ Expression expression = Expressions.call(root,
BuiltInMethod.DATA_CONTEXT_GET.method,
+ Expressions.constant("?" + expr.getIndex()));
+
+ Set<SqlTypeName> toIntegerTypes = Sets.newHashSet(
+ DATE,
+ TIME,
+ TIME_WITH_LOCAL_TIME_ZONE,
+ INTERVAL_YEAR,
+ INTERVAL_YEAR_MONTH,
+ INTERVAL_MONTH);
+
+ Expression midExpress = expression;
+ if (toIntegerTypes.contains(expr.getType().getSqlTypeName())) {
+ SqlTypeName t = expr.getType().getSqlTypeName();
+
+ switch (t) {
+ case DATE:
+ midExpress = Expressions.call(
+ BuiltInMethod.STRING_TO_DATE_ALLOW_NULLABLE.method,
+ convert(expression, String.class));
+ break;
+ case TIME:
+ midExpress = Expressions.call(
+ BuiltInMethod.STRING_TO_TIME_ALLOW_NULLABLE.method,
+ convert(expression, String.class));
+ break;
+ default:
+ //do nothing, if can't support now, just throw exception later
Review Comment:
What about `TIMESTAMP`?
--
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]