Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
In production, we run a sql 'insert into table1 select * from table2' every day,(table1 is a carbon table), but when some one alter table2 add a column, the above sql won't throw exception, and make the data in table1 error. But if table1 is a parquet table, it will throw exception:
`default`.`table1` requires that the data to be inserted have the same number of columns as the target table: target table has 3 column(s) but the inserted data has 4 column(s), including 0 partition column(s) having constant value(s).;
It should also throw exception when the number of insert and select table columns is inconsistent.
Here is the test code, it make the data in table1 error. I will add a pr to fix it.
sql("create table table1 (col1 string, col2 string) partitioned by(pt string) stored by 'carbondata'") sql("create table table2 (t2_c1 string, t2_c2 string, t2_c3 string) partitioned by(pt string)") sql("insert overwrite table table2 partition(pt=20200101) values('v11', 'v12', 'v13')") sql("insert into table1 select * from table2") checkAnswer(sql("select * from table1"), Row("v11", "v12", "v13"))
Attachments
Issue Links
- links to