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

Yao Zhang commented on FLINK-23614:
-----------------------------------

Hi [~TsReaper] [~lzljs3620320],

By the way I found another issue that some methods in SqlFunctionUtils.java are 
not needed by BuiltInMethods.scala. For example, a sround method in 
SqlFunctionUtils.java is defined as:

{code:java}
public static int sround(int b0, int b1) {
    return sround(BigDecimal.valueOf(b0), b1).intValue();
}
{code}

But in BuiltInMethods.scala as shown below, the sround method is loaded from 
SqlFunctions(in Calcite runtime), apparently not from SqlFunctionUtils in Flink.

{code:scala}
val ROUND_INT = Types.lookupMethod(classOf[SqlFunctions], "sround", 
classOf[Int], classOf[Int])
{code}

Do I need to create another ticket for cleaning up those "unnecessary" methods?


> The resulting scale of TRUNCATE(DECIMAL, ...) is not correct
> ------------------------------------------------------------
>
>                 Key: FLINK-23614
>                 URL: https://issues.apache.org/jira/browse/FLINK-23614
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 1.14.0
>            Reporter: Caizhi Weng
>            Assignee: Yao Zhang
>            Priority: Major
>              Labels: pull-request-available, starter
>
> Run the following SQL
> {code:sql}
> SELECT
>   TRUNCATE(123.456, 2),
>   TRUNCATE(123.456, 0),
>   TRUNCATE(123.456, -2),
>   TRUNCATE(CAST(123.456 AS DOUBLE), 2),
>   TRUNCATE(CAST(123.456 AS DOUBLE), 0),
>   TRUNCATE(CAST(123.456 AS DOUBLE), -2)
> {code}
> The result is
> {code}
> 123.450
> 123.000
> 100.000
> 123.45
> 123.0
> 100.0
> {code}
> It seems that the resulting scale of {{TRUNCATE(DECIMAL, ...)}} is the same 
> as that of the input decimal.



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

Reply via email to