You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jingsong Lee (Jira)" <ji...@apache.org> on 2019/12/09 07:37:00 UTC

[jira] [Commented] (FLINK-15141) Using decimal type in a sink table, the result returns a not match ValidationException

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

Jingsong Lee commented on FLINK-15141:
--------------------------------------

Hi [~xiaojin.wy], is this duplicated with https://issues.apache.org/jira/browse/FLINK-15124 ?

> Using decimal type in a sink table, the result returns a not match ValidationException 
> ---------------------------------------------------------------------------------------
>
>                 Key: FLINK-15141
>                 URL: https://issues.apache.org/jira/browse/FLINK-15141
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Client
>    Affects Versions: 1.10.0
>            Reporter: xiaojin.wy
>            Priority: Major
>
> The planner what I used is blink.
> *The source table is:*
>  
> CREATE TABLE `aggtest` (CREATE TABLE `aggtest` ( a smallint, b float) WITH ( 'format.field-delimiter'='|', 'connector.type'='filesystem', 'format.derive-schema'='true', 'connector.path'='hdfs://zthdev/defender_test_data/daily/test_aggregates/sources/aggtest.csv', 'format.type'='csv');
>  
>  
>  
> *The sink table is:*
> CREATE TABLE `agg_decimal_res` (CREATE TABLE `agg_decimal_res` ( avg_107_943 DECIMAL(10, 3)) WITH ( 'format.field-delimiter'='|', 'connector.type'='filesystem', 'format.derive-schema'='true', 'connector.path'='hdfs://zthdev/defender_test_data/daily/test_aggregates/test_aggregates__test_avg_cast_batch/results/agg_decimal_res.csv', 'format.type'='csv');
>  
> *The sql is:*
> INSERT INTO agg_decimal_res SELECT CAST(avg(b) AS numeric(10,3)) AS avg_107_943 FROM aggtest;
>  
> After execute the sql, there will be a exception appear, just like this:
> [INFO] Submitting SQL update statement to the cluster...
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.table.api.ValidationException: Field types of query result and registered TableSink `default_catalog`.`default_database`.`agg_decimal_res1` do not match.
> Query result schema: [avg_107_943: DECIMAL(10, 3)]
> TableSink schema: [avg_107_943: DECIMAL(38, 18)]
>  



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