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

Praveen Kumar commented on CALCITE-3863:
----------------------------------------

For e.g. the current "truncate" operator return type is the same as arg1.  See 
here : 
[https://github.com/apache/calcite/blob/adf4cc4dc5cdb9f5e49c85d10f46a2fdcd831ccf/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L1714]

 

so for e.g. truncate(123.123, 1) outputs 123.100 instead of 123.1. Now this is 
the behavior that other databases like SQL Server adopt but some other 
databases like Impala/Drill/postgres actually return 123.1.

 

We want to make the return type as something that can be overriden by consumers 
(similar to how we do Decimal Sum aggregation).

> Truncate/Round return type inference through rel data type factory
> ------------------------------------------------------------------
>
>                 Key: CALCITE-3863
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3863
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Praveen Kumar
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Allow truncate return type to be inferred through rel data type, so that 
> consumers can override this behavior if required.



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

Reply via email to