You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/09/27 04:48:00 UTC

[jira] [Comment Edited] (CALCITE-4806) When simplifying 'equals', the data type will be ignore

    [ https://issues.apache.org/jira/browse/CALCITE-4806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420477#comment-17420477 ] 

Julian Hyde edited comment on CALCITE-4806 at 9/27/21, 4:47 AM:
----------------------------------------------------------------

Does this only affect INTEGER values? What other types are affected by this bug? Does the problem occur with {{CAST(1.1 AS INT) = 1}}?

The Postgres behavior looks right. We don't usually use SQLite as a reference; I don't think it is that close to the SQL standard.

A more descriptive subject might be 'Lossy CAST is incorrectly simplified'.


was (Author: julianhyde):
Does this only affect INTEGER values? What other types are affected by this bug?

The Postgres behavior looks right. We don't usually use SQLite as a reference; I don't think it is that close to the SQL standard.

> When simplifying 'equals', the data type will be ignore
> -------------------------------------------------------
>
>                 Key: CALCITE-4806
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4806
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: xuyangzhong
>            Priority: Major
>
> the sql is following:
> {code:java}
> // code placeholder
> select cast(1.1 as int) = cast (1 as int){code}
> In SQLite the result is 1 and in postgreSQL the result is true.
> But in calcite the result is false.
> The bug is in RexSimplify and 1.1 and 1 are all converted to java.lang.Comparable, and 1.1 doesn't equal to 1. It ignores the source data type. The literal 1.1 should be cast to 1(int) first.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)