我有一个文本格式的配置单元表,如: CREATE EXTERNAL TABLE op_log ( time string, debug string,app_id string,app_version string, ...more fields) PARTITIONED BY (dt string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE;
现在我创建一个orc格式的表,其中包含相同的字段,如 CREATE TABLE op_log_orc ( time string, debug string,app_id string,app_version string, ...more fields) PARTITIONED BY (dt string) STORED AS ORC tblproperties ("orc.compress" = "SNAPPY");
当我从 op_log
至 op_log_orc
,我得到了以下错误: hive> insert into op_log_orc PARTITION(dt='2016-08-09') select * from op_log where dt='2016-08-09'; FAILED: SemanticException [Error 10044]: Line 1:12 Cannot insert into target table because column number/types are different ''2016-08-09'': Table insclause-0 has 62 columns, but query has 63 columns. hive>
1条答案
按热度按时间mbyulnm01#
分区键(
dt
)在源表中,返回的结果集就好像它是一个常规字段一样,因此您有了额外的列。排除dt
字段列表中的字段(而不是*
)如果要在分区键中指定它的值。或者,只需指定dt
作为分区的名称,但不提供值。请参见以下示例中的CTA(创建表作为选择…):https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#languagemanualddl-CreateTableAssetSelect(ctas)