[
https://issues.apache.org/jira/browse/CALCITE-3884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17072358#comment-17072358
]
Chunwei Lei commented on CALCITE-3884:
--------------------------------------
I checked the docs of PostgreSQL[1] and it says the return type of SIGN is the
same as the input.
[1][https://www.postgresql.org/docs/12/functions-math.html]
> 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
> Priority: Minor
>
> 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)