You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Wenzhe Zhou (Jira)" <ji...@apache.org> on 2021/03/08 22:33:00 UTC

[jira] [Commented] (IMPALA-10564) No error returned when inserting an overflowed value into a decimal column

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

Wenzhe Zhou commented on IMPALA-10564:
--------------------------------------

The issue could be re-produced with CTAS statement and INSERT-SELECT statement if the value expressions for decimal have at least one alias. Value NULL were inserted into the tables when there are decimal overflow. But user expect Impala should return an error without inserting NULL to the table.

Here are some sample queries running with the latest Impala code. 

[localhost:21050] default> create table t1 (abc_28 decimal(28,10));
Query: create table t1 (abc_28 decimal(28,10))
+-------------------------+
|summary|

+-------------------------+
|Table has been created.|

+-------------------------+
Fetched 1 row(s) in 0.14s
[localhost:21050] default> insert into table t1 select cast(a*b*c as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a, cast(44658554984 as decimal (28,7)) as b, cast(2.111 as decimal (28,7)) as c) q;
Query: insert into table t1 select cast(a*b*c as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a, cast(44658554984 as decimal (28,7)) as b, cast(2.111 as decimal (28,7)) as c) q
Query submitted at: 2021-03-05 15:28:18 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=75493752776530e0:e291ef6c00000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=75493752776530e0:e291ef6c00000000]
Modified 1 row(s) in 0.54s
[localhost:21050] default> insert into table t1 select cast(a*44658554984*2.111 as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a) q;
Query: insert into table t1 select cast(a*44658554984*2.111 as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a) q
Query submitted at: 2021-03-05 15:29:02 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=5e4886bf38d608a8:02ddf53f00000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=5e4886bf38d608a8:02ddf53f00000000]
Modified 1 row(s) in 0.41s
[localhost:21050] default> select * from t1;
Query: select * from t1
Query submitted at: 2021-03-05 15:29:08 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=56466b26a8cbf1f2:5423cab500000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=56466b26a8cbf1f2:5423cab500000000]
+--------+
|abc_28|

+--------+
|NULL|
|NULL|

+--------+
Fetched 2 row(s) in 0.12s
[localhost:21050] default> insert into table t1 select cast(cast(654964569154.9565 as decimal (28,7))*44658554984*2.111 as decimal (28,10));
Query: insert into table t1 select cast(cast(654964569154.9565 as decimal (28,7))*44658554984*2.111 as decimal (28,10))
Query submitted at: 2021-03-05 15:29:23 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=cd47ef02e8e6d233:9edfe7a500000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=cd47ef02e8e6d233:9edfe7a500000000]
ERROR: UDF ERROR: Decimal expression overflowed

[localhost:21050] default>

[localhost:21050] default> create table t2 stored as parquet as select cast(cast(654964569154.9565 as decimal (28,7))*44658554984*2.111 as decimal (28,10));
Query: create table t2 stored as parquet as select cast(cast(654964569154.9565 as decimal (28,7))*44658554984*2.111 as decimal (28,10))
Query submitted at: 2021-03-05 19:48:52 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=2d40d20bd6e05934:426ea3d100000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=2d40d20bd6e05934:426ea3d100000000]
ERROR: UDF ERROR: Decimal expression overflowed

[localhost:21050] default> create table t3 stored as parquet as select cast(a*44658554984*2.111 as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a) q;
Query: create table t3 stored as parquet as select cast(a*44658554984*2.111 as decimal (28,10)) from (select cast(654964569154.9565 as decimal (28,7)) as a) q
Query submitted at: 2021-03-05 19:49:43 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=7945745a33e734ff:728a7cbb00000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=7945745a33e734ff:728a7cbb00000000]
+-------------------+
|summary|

+-------------------+
|Inserted 1 row(s)|

+-------------------+
Fetched 1 row(s) in 0.54s
[localhost:21050] default> select * from t3;
Query: select * from t3
Query submitted at: 2021-03-05 19:49:53 (Coordinator: [http://wzhou-OptiPlex-9020:25000|http://wzhou-optiplex-9020:25000/])
Query progress can be monitored at: [http://wzhou-OptiPlex-9020:25000/query_plan?query_id=d341b4078d9f24ea:4023dc1800000000|http://wzhou-optiplex-9020:25000/query_plan?query_id=d341b4078d9f24ea:4023dc1800000000]
+------+
|_c0|

+------+
|NULL|

+------+
Fetched 1 row(s) in 0.12s
[localhost:21050] default>

 

> No error returned when inserting an overflowed value into a decimal column
> --------------------------------------------------------------------------
>
>                 Key: IMPALA-10564
>                 URL: https://issues.apache.org/jira/browse/IMPALA-10564
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend, Frontend
>    Affects Versions: Impala 4.0
>            Reporter: Wenzhe Zhou
>            Priority: Major
>
> When using CTAS statements or INSERT-SELECT statements to insert rows to table with decimal columns, Impala insert NULL for overflowed decimal values, instead of returning error. This issue happens when the data expression for the decimal column in SELECT sub-query consists at least one alias. This issue is similar as IMPALA-6340, but IMPALA-6340 only fixed the issue for the cases with the data expression for the decimal columns as constants so that the overflowed decimal values could be detected by frontend during expression analysis.  If there is alias (variables) in the data expression for the decimal column, Frontend could not evaluate data expression in expression analysis phase. Only backend could evaluate the data expression when backend execute fragment instances for SELECT sub-queries. The log messages showed that the executor detected the decimal overflow error, but somehow it did not propagate the error to the coordinator, hence the error was not returned to the client.  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org