0

我有一个文本格式配置单元表,例如: 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;

现在我创建一个具有相同字段的兽人格式表,例如 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当我从to复制时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>

4

1 回答 1

0

源表中的分区键 ( dt) 在结果集中返回,就好像它是常规字段一样,因此您有额外的列。如果要在分区键中指定其值,请dt从字段列表中排除该字段(而不是 )。*或者,只指定dt分区的名称,而不提供值。请参阅此处示例中的 CTAS(创建表作为选择...):https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableAsSelect(CTAS)

于 2016-08-09T03:19:49.320 回答