You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "yanjing.wang (Jira)" <ji...@apache.org> on 2021/08/23 06:37:00 UTC

[jira] [Created] (CALCITE-4749) Division with two operands of integer family can't return value with decimal data type.

yanjing.wang created CALCITE-4749:
-------------------------------------

             Summary: Division with two operands of integer family can't return value with decimal data type.
                 Key: CALCITE-4749
                 URL: https://issues.apache.org/jira/browse/CALCITE-4749
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.27.0
         Environment: jdk8

macos
            Reporter: yanjing.wang


I tested the following sql
{code:java}
select cast(1 as bigint) / 1000
{code}
Calcite use the least restrictive dataType BIGINT as return type between the BIGINT and INT and result is 0, which is consistent with SQL SERVER and PostgreSQL. Whereas BigQuery, Oracle, MySQL and Spark returns 0.001.

 

I think Calcite should support both behaviors.

 



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