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

Jacky Li edited comment on CARBONDATA-3652 at 1/5/20 6:34 AM:
--------------------------------------------------------------

You mean in this case, user should use 
{code:sql}
use insert into table1 select required_columns from table2
{code}
after adding new column in table2?


was (Author: jackylk):
You mean in this case, user should use insert into table1 select 
required_columns from table2 after adding new column in table2?

> 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: 40m
>  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)

Reply via email to