You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2018/09/16 16:56:00 UTC
[jira] [Created] (CALCITE-2562) Suspicious code in
org.apache.calcite.sql2rel.StandardConvertletTable#convertDatetimeMinus
Vladimir Sitnikov created CALCITE-2562:
------------------------------------------
Summary: Suspicious code in org.apache.calcite.sql2rel.StandardConvertletTable#convertDatetimeMinus
Key: CALCITE-2562
URL: https://issues.apache.org/jira/browse/CALCITE-2562
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.17.0
Reporter: Vladimir Sitnikov
Assignee: Julian Hyde
https://github.com/apache/calcite/blob/ca858dd725dea6bf9b4a9059cf1c3ba98bd82f26/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L626-L640
{code:java} final RexNode[] casts = new RexNode[2];
casts[0] =
rexBuilder.makeCast(
cx.getTypeFactory().createTypeWithNullability(
int8Type,
exprs.get(0).getType().isNullable()),
exprs.get(0));
casts[1] =
rexBuilder.makeCast(
cx.getTypeFactory().createTypeWithNullability(
int8Type,
exprs.get(1).getType().isNullable()),
exprs.get(1));
final RelDataType resType =
cx.getValidator().getValidatedNodeType(call);
return rexBuilder.makeCall(resType, op, exprs.subList(0, 2));
{code}
{{casts}} array is never read.
Are casts required there?
Should {{Arrays.asList(casts)}} be used instead of {{exprs.subList(0, 2)}}?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)