我正在尝试在表中创建动态分区。
1)第一个表称为stock1,其中驻留了未分区的数据。
这是模式:
hive> describe stock1;
id int
xcg string
stock string
sector string
country string
dt string
open float
high float
low float
close float
volume int
adj_close float
2)第二张表是stock2,我希望在其中对数据进行动态分区。
hive> create table stock2(id int,stock string,sector string,country string,dt string,open float,high float,low float,close float,volume int,adj_close float) PARTITIONED BY (xchng string);
3)现在启用动态分区:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
4)将数据从stock1加载到stock2中。
insert overwrite table stock2 partition(xchng)select id,stock,sector,country,dt,open,high,low,close,volume,adj_close,t.xcg as xchng from stock1 t;
现在,当我检查hive文件夹下的stock2时,我只会看到一个默认分区
/user/hive/warehouse/stock.db/stock2/xchng= HIVE_DEFAULT_PARTITION
如何更正,以便为每个xchng获得单独的文件夹。
最佳答案
您可以检查“stock1”中的所有“xcg”值吗?至少某些值或所有值可能不符合String格式。我的意思是前。可以为null或数字,而不是字符串。
关于hadoop - 配置单元动态分区不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37090944/