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 2020/11/12 18:37:00 UTC
[jira] [Comment Edited] (CALCITE-4397)
StandardConvertletTable#convertDatetimeMinus is inconsistent with
MINUS_DATE return type inference
[ https://issues.apache.org/jira/browse/CALCITE-4397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17230849#comment-17230849 ]
Vladimir Sitnikov edited comment on CALCITE-4397 at 11/12/20, 6:36 PM:
-----------------------------------------------------------------------
There's another operator which happens to omit return type inference: REINTERPRET.
The context for the issue is RexSimplify that might want to re-create RexCall in case its operands are simplified.
For instance, {{*(0, cast(1 as integer))}} is nullable, however it is simplified to {{*(0, 1)}} which is non-nullable. If we always use the original type, then we might produce suboptimal (and weird) results like "nullable 0+1".
On the other hand, if we always use inference, we run into cases like MINUS_DATE and REINTERPRET.
The tests pass with these two exceptions though.
was (Author: vladimirsitnikov):
There's another operator which happens to omit return type inference: REINTERPRET.
The context for the issue is RexSimplify that might want to re-create RexCall in case its operands are simplified.
For instance, {{+(0, cast(1 as integer))}} is nullable, however it is simplified to {{+(0, 1)}} which is non-nullable. If we always use the original type, then we might produce suboptimal (and weird) results like "nullable 0+1".
On the other hand, if we always use inference, we run into cases like MINUS_DATE and REINTERPRET.
The tests pass with these two exceptions though.
> StandardConvertletTable#convertDatetimeMinus is inconsistent with MINUS_DATE return type inference
> --------------------------------------------------------------------------------------------------
>
> Key: CALCITE-4397
> URL: https://issues.apache.org/jira/browse/CALCITE-4397
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: Vladimir Sitnikov
> Priority: Major
>
> SqlNode representation has 3 parameters: {{datetime}} - {{datetime}} {{interval_qualifier}}
> The return type inference is {{ARG2_NULLABLE}} so it assumes the call has three parameters.
> In practice, {{convertDatetimeMinus}} removes the last parameter via {{rexBuilder.makeCall(resType, op, exprs.subList(0, 2));}}, which blocks node cloning via {{rexBuilder.makeCall(e.getOperator(), operands)}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)