1. 程式人生 > >Hive分割槽partition詳解

Hive分割槽partition詳解

請看原文作者的部落格:
https://blog.csdn.net/qq_36743482/article/details/78418343

我補充的是:
外部表的分割槽 :

create external table t2(
    id      int
   ,name    string
   ,hobby   array<string>
   ,add     map<String,string>
)
partitioned by (pt_d string)
row format delimited
fields terminated by ','
collection items terminated by '-'
map keys terminated by ':'
location '/user/d4t2'

載入資料:

load data local inpath '/home/hadoop/apps/hiveData/t2.txt' overwrite into table t2 partition ( pt_d = '201701');

再載入一次:

load data local inpath '/home/hadoop/apps/hiveData/t2.txt' overwrite into table t2 partition ( pt_d = '201801');

你會發現會在外部表存放資料檔案的資料夾裡面會有兩個檔案被載入到裡面了。

在這裡插入圖片描述