code1
SQL语句:
insert overwrite table `demo.run_peak_kpi_inc1` partition (dt)
select elevator_id, unit_guid, peak_flag, peak_range_time, peak_run_num, peak_time, peak_run_time, peak_run_rate, peak_crowding,
peak_call_wait_avg_time, relative_peak_range_time, relative_peak_run_num, peak_ride_elevator_time, total_run_num, sum_run_time5, dt
from demo.run_peak_kpi_inc where dt in('20240918','20240924')
报错信息:
[08S01][1] Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 2 in table run_peak_kpi_inc1 with loadPath=hdfs://test-bigdata-01:8020/user/hive/warehouse/demo.db/run_peak_kpi_inc1/.hive-staging_hive_2024-11-06_15-59-58_719_3512888189699090378-907/-ext-10000
原因:
在hdfs上删除了分区,但表未删除分区,在插入时就会导致无法清理该分区信息,进行重新创建分区
解决办法:
1.查看分区,保持hdfs和表分区信息一致
2.分区字段加在查询末尾
show partitions demo.run_peak_kpi_inc1;
ALTER TABLE demo.run_peak_kpi_inc1 DROP PARTITION (dt='20240918');
code3
解决办法:
1. 设置 hive.exec.max.dynamic.partitions
含义:这个参数控制了整个查询中允许的最大动态分区数。
2. 设置 hive.exec.max.dynamic.partitions.pernode
含义:这个参数控制了每个节点上允许的最大动态分区数。
set hive.exec.max.dynamic.partitions=50000;
set hive.exec.max.dynamic.partitions.pernode=10000;