0
我試圖使用HIVE創建分區和桶。HIVE:在HDFS中分區後創建空桶
用於設置的一些屬性:
set hive.enforce.bucketing = true;
SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;
下面是用於創建表的代碼:
CREATE TABLE transactions_production
(id string,
dept string,
category string,
company string,
brand string,
date1 string,
productsize int,
productmeasure string,
purchasequantity int,
purchaseamount double)
PARTITIONED BY (chain string) clustered by(id) into 5 buckets
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
下面是用於插入數據到表中的代碼:
INSERT OVERWRITE TABLE transactions_production PARTITION (chain)
select id, dept, category, company, brand, date1, productsize, productmeasure,
purchasequantity, purchaseamount, chain from transactions_staging;
出錯了:
分區和分區正在HDFS中創建,但數據僅存在於所有分區的第一個分區中;所有剩餘的桶都是空的。
請讓我知道我做錯了什麼,以及如何解決這個問題。