You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2018/09/21 20:09:00 UTC
[jira] [Resolved] (CALCITE-2562) Suspicious code in
org.apache.calcite.sql2rel.StandardConvertletTable#convertDatetimeMinus
[ https://issues.apache.org/jira/browse/CALCITE-2562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Sitnikov resolved CALCITE-2562.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.18.0
Fixed in https://git-wip-us.apache.org/repos/asf?p=calcite.git;a=commit;h=17e0a054259f10079ce9c95fa01f447e41a84577
> 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
> Priority: Major
> Fix For: 1.18.0
>
>
> 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)