SemanticException分区规范{col = null}包含非分区列

时间:2015-04-15 11:17:17

标签: dynamic hive partitioning

我正在尝试使用以下代码在配置单元中创建动态分区。

SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;

create external table if not exists report_ipsummary_hourwise(
ip_address string,imp_date string,imp_hour bigint,geo_country string)
PARTITIONED BY (imp_date_P string,imp_hour_P string,geo_coutry_P string) 
row format delimited 
fields terminated by '\t'
stored as textfile
location 's3://abc';

insert overwrite table report_ipsummary_hourwise PARTITION (imp_date_P,imp_hour_P,geo_country_P)
SELECT ip_address,imp_date,imp_hour,geo_country,
       imp_date as imp_date_P,
       imp_hour as imp_hour_P,
       geo_country as geo_country_P
FROM report_ipsummary_hourwise_Temp;

其中report_ipsummary_hourwise_Temp表包含以下列, IP_ADDRESS,imp_date,imp_hour,GEO_COUNTRY。

我收到此错误

  

SemanticException分区规范{imp_hour_p = null,imp_date_p = null,   geo_country_p = null}包含非分区列。

有人能说出为什么会出现这个错误吗?

4 个答案:

答案 0 :(得分:4)

您插入的sql具有geo_country_P列,但目标表列名称为geo_coutry_P。错过国家

中的 n

答案 1 :(得分:0)

我遇到了同样的错误。这是因为文件中存在额外的字符。 最佳解决方案是删除所有空白字符,然后重新插入。

答案 2 :(得分:0)

它表示将文件从结果复制到hdfs作业时无法识别分区位置。我可以怀疑你有分区表(imp_date_P,imp_hour_P,geo_country_P),而作业正在尝试复制imp_hour_p = null,imp_date_p = null,geo_country_p = null,它不匹配..来检查hdfs位置..另外一点我建议不要重复列名和分区两次

答案 3 :(得分:0)

也可能是https://issues.apache.org/jira/browse/HIVE-14032

INSERT OVERWRITE命令失败,区分大小写的分区键名称

Hive中存在一个错误,它使分区列名称区分大小写。

对我来说,修复是表中的列名必须都是小写的 表定义中的PARTITION BY子句必须是小写的。 (它们也可能都是大写的;由于这个Hive bug HIVE-14032,这个案例必须匹配)

相关问题