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

Chunwei Lei edited comment on CALCITE-3884 at 4/1/20, 3:47 AM:
---------------------------------------------------------------

Thanks for reporting this. But 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]


was (Author: chunwei lei):
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)

Reply via email to