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

Stamatis Zampetakis commented on CALCITE-4749:
----------------------------------------------

If I understand well you encountered the problem when going from SQL to 
{{RelNode}} and not from {{RelNode}} to SQL as I originally thought so you can 
ignore my comment.

Just so you know in every dialect you can pass a custom type system. See for 
instance the how a custom type system is passed in 
[PostgresSqlDialect|https://github.com/apache/calcite/blob/94e2f98d9769ea17b9e8a6a478802f78a745e3f0/core/src/main/java/org/apache/calcite/sql/dialect/PostgresqlSqlDialect.java#L67].
 


> 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
>            Priority: Major
>
> 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)

Reply via email to