You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Juhwan Kim (Jira)" <ji...@apache.org> on 2020/03/28 05:45:00 UTC

[jira] [Created] (CALCITE-3884) Return type for SIGN function is incorrect

Juhwan Kim created CALCITE-3884:
-----------------------------------

             Summary: Return type for SIGN function is incorrect
                 Key: CALCITE-3884
                 URL: https://issues.apache.org/jira/browse/CALCITE-3884
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Juhwan Kim


It appears the metadata for the SIGN function in Calcite is incorrect, it uses the input metadata as the output metadata.

[ SqlStdOperatorTable.java#L1713 | https://github.com/apache/calcite/blob/1c261ebeb65e775b908cb878e905410ce78cda80/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L1713]

This works in most cases but for Decimal where prec=scale, this doesn’t work since there can be no whole digits. The return metadata should really be an int, or if you want to match types then DECIMAL(1, 0) if the input metadata is any DECIMAL.



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