FAILED: SemanticException [Error 10044]: Line 1:24 Cannot insert into target table because column number/types are different 'deptno': Table insclause-0 has 3 columns, but query has 4 columns.
遇到这种错误,就是说查询的结果和写入的表列数对不上。
第一种错误原因:
多数发生在采用insert into/overwrite xxxx select xx from 方式向动态分区表中插入数据,因为动态分区是根据字段位置写入数据的。如果分区表加分区字段都没有select的字段多,就会报表有XX列,但是查询的时候有>XX列。
第二种错误原因:
采用insert into/overwrite xxxx select xx from向表中插入数据,增加了写入的字段,但是没有对表进行alter 操作,导致列数对不上,单独执行alter语句,就可以解决问题。