Hive 分割槽的具體操作

2021-09-19 04:30:03 字數 2067 閱讀 7752

建立乙個一級分割槽

create table if not exists day_part(

uid int,

uname string

)partitioned by (year int)

row format delimited

fields terminated by '\t'

;

load入資料:

load data local inpath '/root/day_part.txt' overwrite into table day_part partition (year=2017);

load data local inpath '/root/day_part.txt' into table day_part partition (year=2018);

檢視分割槽

show partitions day_part;
select * from day_part where year=2017; 查詢時指定分割槽,不必全表掃瞄

create table if not exists day_part1(

uid int,

uname string

)partitioned by (year int ,mouth int)

row format delimited

fields terminated by '\t'

;

寫進資料:

load data local inpath '/root/day_part.txt' overwrite into table day_part1 partition (year=2019,month=04);

load data local inpath '/root/day_part.txt' overwrite into table day_part1 partition (year=2019,month=03);

查詢:

顯示分割槽

show partitions day_part1;
新增分割槽

alter table day_part1 add partition(year=2017,month=1);
新增多個分割槽:

alter table day_part1 add partition(year=2017,month=2) partition(year=2017,month=3);
新增分割槽並載入資料:

alter table day_part1 add partition(year=2017,month=10) location

"/user/hive/warehouse/buc1"

修改分割槽所對應的路徑

alter table day_part1 partition(year=2017,month=10) set location

"hdfs://mini1:9000/user/hive/warehouse/log_1" ##路徑必須是絕對路徑。從hdfs://mini1:9000開始

刪除分割槽

alter table day_part1 drop partition (year=2017,month=1);

show partitions day_part1;

Spring 具體操作

1.建立物件 ioc建立物件的方式1.預設使用無參構造建立物件 2.在呼叫 getbean 方法時,配置檔案內的所有物件都被建立 使用有參構造建立物件 xmlns xmlns xsi xsi schemalocation user class com.liye.pojo.user name age ...

MFC ListControl 具體操作詳細用法

1 listcontrol初始化 listcontrol初始化 新增在虛函式cdlg oninitdialog 中 m mylist.modifystyle 0l,lvs showselalways dword dwstyle m mylist.getextendedstyle dwstyle lv...

github fork工作(具體操作)

更新於20201110 git add remote upstream url.git 遠端庫,公共開發倉庫 git add remote localhost url.git 本地庫,自己倉庫切換到轉殖的資料夾 cd 在本地建立乙個新的分支,用來提交 git checkout b cq b第一次使用...