Since you already know the full schema of the target table, try creating it first and populating it with the LOAD DATA command:
SET hive.exec.dynamic.partition.mode=nonstrict; CREATE TABLE T (key int, value string) PARTITIONED BY (ds string, hr int); INSERT OVERWRITE TABLE T PARTITION(ds, hr) SELECT key, value, ds, hr+1 AS hr FROM srcpart WHERE ds is not null And hr>10;
Note: the set command is necessary since you are performing a full dynamic insertion of partitions.
Simplefish
source share