2014-10-20 83 views
1

蜂巢支持範圍分區嗎?蜂巢中的範圍分區

我的意思是做蜂巢支持類似如下:

insert overwrite table table2 PARTITION (employeeId BETWEEN 2001 and 3000) 
select employeeName FROM emp10 where employeeId BETWEEN 2001 and 3000; 

凡表2 & emp10有兩列:

employeeName & 僱員

當我運行上面的查詢我面臨的一個錯誤:

FAILED: ParseException line 1:56 mismatched input 'BETWEEN' expecting) near 'employeeId' in destination specification 

回答

2

是不可能的。以下是來自Hive documentation的報價:

A table can have one or more partition columns and a separate data directory is created for each distinct value combination in the partition columns

1

沒有它不可能。即使我使用單獨的計算列類似,

insert overwrite table table2 PARTITION (employeeId_range) select employeeName , employeeId/1000 FROM emp10 where employeeId BETWEEN 2000 and 2999;

這將確保所有值處在同一個分區。 而查詢的表,因爲我們已經知道的範圍內計算,我們可以

select employeeName , employeeId FROM table2 where employeeId_range=2;

因此我們也可以parallelise給定範圍的查詢。 希望它有幫助。