[ https://issues.apache.org/jira/browse/CARBONDATA-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hong Shen updated CARBONDATA-3652: ---------------------------------- 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: {code} `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).; {code} 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. {code} 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")) {code} was: 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. {code} 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")) {code} > No exception is thrown when the number of insert and select table columns is inconsistent > ----------------------------------------------------------------------------------------- > > Key: CARBONDATA-3652 > URL: https://issues.apache.org/jira/browse/CARBONDATA-3652 > Project: CarbonData > Issue Type: Bug > Components: spark-integration > Reporter: Hong Shen > Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > 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: > {code} > `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).; > {code} > 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. > {code} > 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")) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) |
Free forum by Nabble | Edit this page |