apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.3k stars 3.21k forks source link

[Bug] insert into tinyint type column from bigint column #7527

Open 13671653088 opened 2 years ago

13671653088 commented 2 years ago

Search before asking

Version

Both 0.14.12.4 and 0.15.1-rc03

What's Wrong?

When I select value 169 from a bigint column in source table, and insert into the tinyint column in target table. It seem success but the value becomes -87.

What You Expected?

May be it should show "Number out of range[169]. type: TINYINT"

How to Reproduce?

-- create target table CREATE TABLE test.test ( id int(11) NULL COMMENT "", abc tinyint replace_if_not_null NULL Comment"" ) ENGINE=OLAP AGGREGATE KEY(id) COMMENT "OLAP" DISTRIBUTED BY HASH(id) BUCKETS 6 PROPERTIES ( "replication_allocation" = "tag.location.default: 3", "in_memory" = "false", "storage_format" = "V2" ); -- Input some test data insert into test.test(id,abc) select 1,100;

-- Number out of range[169]. type: TINYINT insert into test.test(id,abc) select 2,169;

-- create source table CREATE TABLE test.test1 ( id int(11) NULL COMMENT "", abc bigint replace_if_not_null NULL Comment"" ) ENGINE=OLAP AGGREGATE KEY(id) COMMENT "OLAP" DISTRIBUTED BY HASH(id) BUCKETS 6 PROPERTIES ( "replication_allocation" = "tag.location.default: 3", "in_memory" = "false", "storage_format" = "V2" ); -- Input some test data insert into test.test1(id,abc) select 1,100; insert into test.test1(id,abc) select 2,169;

-- It seem success but the value becomes -87. insert into test.test(id,abc) select * from test.test1; select * from test.test

Anything Else?

global variables enable_insert_strict=true

Are you willing to submit PR?

Code of Conduct

whutpencil commented 2 years ago

Hive is also implemented in this way.