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

Shuai Xia commented on FLINK-19796:
-----------------------------------

{code:java}
// precision=3,scale=2
create table print_sink(
        data array<decimal(3,2)>
) with (
      'connector' = 'print'
);

// 0.12(precision=3,scale=2)
// 0.5(precision=2,scale=1)
// 0.50(precision=3,scale=2)
insert into print_sink
select array[0.12, 0.5, 0.50];

// result  +I([0.12, 0.05, 0.50]){code}
Precision when parsing create statement: < Precision:3 , Scale:2 >
 Precision when parsing query statements: < Precision:2 , Scale:1 > 
 When using the converter, the accuracy: < Precision:3 , Scale:2 > 
[check|https://github.com/apache/flink/blob/61b1106615773268eb08ffcd2c9b6fe74a6fd663/flink-table/flink-table-common/src/main/java/org/apache/flink/table/data/ArrayData.java#L186]
 The accuracy of both sides does not match

@[~jark]  @[~lzljs3620320]  

> Error results when use constant decimal array
> ---------------------------------------------
>
>                 Key: FLINK-19796
>                 URL: https://issues.apache.org/jira/browse/FLINK-19796
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 1.11.2
>            Reporter: Zou
>            Assignee: Zou
>            Priority: Major
>
> The result is wrong when use constant decimal array with different precisions.
>  Here is an example:
> {code:sql}
> create table print_sink(
>       data array<decimal(3,2)>
> ) with (
>       'connector' = 'print'
> );
> insert into print_sink
> select array[0.12, 0.5, 0.99];
> {code}
> The result will be:
> {code:java}
> +I([0.12, 0.05, 0.99])
> {code}



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

Reply via email to