You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dalongliu (Jira)" <ji...@apache.org> on 2023/02/27 09:14:00 UTC

[jira] [Commented] (FLINK-31239) Fix sum function can't get the corrected value when the argument type is string

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

dalongliu commented on FLINK-31239:
-----------------------------------

Currently, for the following case:
{code:java}
tableEnv.executeSql("create table test_sum_dec(a int, x string, z decimal(10, 5))");
tableEnv.executeSql(
                "insert into test_sum_dec values (1, 'b', null), "
                        + "(1, 'b', 1.2), "
                        + "(2, 'b', null), "
                        + "(2, 'b', null),"
                        + "(4, '1', null),"
                        + "(4, 'b', null)")
        .await();

List<Row> result =
        CollectionUtil.iteratorToList(
                tableEnv.executeSql("select a, sum(x) from test_sum_dec group by a")
                        .collect());
assertThat(result.toString()).isEqualTo("[+I[1,null], +I[2, null], +I[4, 1.0]]");
 {code}
The native sum function return `[+I[1,null], +I[2, null], +I[4, 1.0]]`, but hive sum function return `[+I[1,0.0], +I[2,0.0], +I[4, 1.0]]`. The native function return result is not consistent with hive, so we should fix it.

> Fix sum function can't get the corrected value when the argument type is string
> -------------------------------------------------------------------------------
>
>                 Key: FLINK-31239
>                 URL: https://issues.apache.org/jira/browse/FLINK-31239
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Connectors / Hive
>    Affects Versions: 1.17.0
>            Reporter: dalongliu
>            Priority: Major
>             Fix For: 1.17.0
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)