蜂巢中的匯出功能

將 employees 表中的資料匯出到/ tmp / ca_employees

INSERT OVERWRITE LOCAL DIRECTORY’/ tmp / ca_employees’SELECT 名稱,工資,地址 FROM employees WHERE se.state =‘CA’;

根據特定條件將 employees 表中的資料匯出到多個本地目錄

以下查詢顯示瞭如何使用單個構造根據特定條件將資料匯出到多個目錄

FROM employees se INSERT OVERWRITE DIRECTORY '/tmp/or_employees' SELECT * WHERE se.cty = 'US' and se.st = 'OR'
INSERT OVERWRITE DIRECTORY '/tmp/ca_employees' SELECT * WHERE se.cty = 'US' and se.st = 'CA'
INSERT OVERWRITE DIRECTORY '/tmp/il_employees' SELECT * WHERE se.cty = 'US' and se.st = 'IL';