大資料開發學習之Hive的靜態分割槽

2021-08-20 18:47:57 字數 683 閱讀 9576

分割槽是hive存放資料的一種方式。將列值作為目錄來存放資料,就是乙個分割槽。這樣查詢時使用分割槽列進行過濾,只需根據列值直接掃瞄對應目錄下的資料,不掃瞄其他不關心的分割槽,快速定位,提高查詢效率。hive分割槽分為靜態分割槽和動態分割槽兩種,以下是hive的靜態分割槽。

靜態分割槽:若分割槽的值是確定的,那麼稱為靜態分割槽。新增分割槽或者是載入分割槽資料時,已經指定分割槽名。

create table if not exists day_part1(

uid int,

uname string

)partitioned by(year int,month int)

row format delimited fields terminated by '\t';

##載入資料指定分割槽

load data local inpath '/root/desktop/students.txt' into tableday_part1 partition(year=2018,month=06);

##新增分割槽指定分割槽名

alter table day_part1 add partition(year=2018,month=1)partition(year=2018,month=2);

分割槽注意細節

(1)、盡量不要用動態分割槽,因為動態分割槽

大資料學習之Hive

建立乙個自定義列表 如何建立乙個註腳 注釋也是必不可少的 katex數學公式 新的甘特圖功能,豐富你的文章 uml 圖表 flowchart流程圖 匯出與匯入 1 hive處理的資料儲存在hdfs 2 hive分析資料底層的實現是mapreduce 3 執行程式執行在yarn上 hive的優缺點 帶...

大資料之Hive《五》

1 語法hive load data local inpath opt module datas student.txt overwrite into table student partition partcol1 val1,1 load data 表示載入資料 2 local 表示從本地載入資料...

大資料之Hive常見函式

hive中常見的sql函式 顯示host位址 select parse url 位址 host 例項 select parse url host 字串連線函式 1 concat 函式 將多個字串用特定符號鏈結成乙個字串 concat constellation,blood type,欄位1,欄位2,...