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



我正在尝试使用以下代码在 hive 中创建动态分区。

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 Partition spec {imp_hour_p=null, imp_date_p=null, geo_country_p=null} 包含非分区列。

任何人都可以建议为什么会出现此错误吗?

您插入 sql 具有geo_country_P列,但目标表列名是 geo_coutry_P . 在 Country

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

插入覆盖命令失败,分区键名称区分大小写

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

对我来说,修复是表中的两个列名都必须小写表定义中的 PARTITION BY 子句必须是小写的。(它们也可以都是大写的;由于这个Hive错误HIVE-14032,大小写只需要匹配)

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

report_ipsummary_hourwise分区插入覆盖表 (imp_date_P,imp_hour_P,geo_country_P)选择ip_address,imp_date,imp_hour,geo_country,imp_date imp_date_P,imp_hour imp_hour_P,geo_country 饰 geo_country_P从report_ipsummary_hourwise_Temp;

突出显示的字段应与report_ipsummary_hourwise文件中可用的名称相同

最新更新