HiveQL 常見用法說明

2021-10-02 03:58:33 字數 1591 閱讀 1393

動態分割槽配置

set hive.

exec

.dynamic.

partition

.mode

=nonstrict;

建 parquet 格式分割槽表
create

table user_db.test_table (

user_id string comment

'使用者id'

, adress string comment

'位址'

) partitioned by

(date string)

row format delimited

stored as parquet

location '/user/hadoop/hive/user_db/test_table'

;

本週周一
select date_sub(

'2020-03-15'

,cast(date_format(

'2020-03-15'

,'u')as

int)-1

);

內錶改外表
alter

table dws.dws_test set tblproperties (

'external'

='true'

);

外表改內表
alter

table dws.dws_test set tblproperties (

'external'

='false'

);

改location
alter

table dws.dws_test set location '******'

;

新增空分割槽
alter

table dws.dws_test add

partition

(ds =

'2019-02-12'

);

刪除分割槽
alter

table dws.dws_test drop

partition

(ds =

'2019-02-12'

);

修復分割槽
msck repair table dws.dws_test;
欄位加注釋
alter

table table_name change column muid muid_new string comment

'這裡是列注釋!'

;

表加注釋
alter

table table_name set tblproperties(

'comment'

='這是表注釋!'

);

改表生命週期
alter

table table_name set lifecycle 100

;

C Map常見用法說明

三 取值 四 容量查詢 五 迭代器 六 刪除交換 七 順序比較 八 查詢 九 操作符 c 中map提供的是一種鍵值對容器,裡面的資料都是成對出現的,如下圖 每一對中的第乙個值稱之為關鍵字 key 每個關鍵字只能在map中出現一次 第二個稱之為該關鍵字的對應值。標頭檔案 include map id ...

C Map常見用法說明

三 取值 三 取值 四 容量查詢 五 迭代器 六 刪除交換 七 順序比較 八 查詢 九 操作符 c 中map提供的是一種鍵值對容器,裡面的資料都是成對出現的,如下圖 每一對中的第乙個值稱之為關鍵字 key 每個關鍵字只能在map中出現一次 第二個稱之為該關鍵字的對應值。標頭檔案 include ma...

C Map常見用法說明

c 中map提供的是一種鍵值對容器,裡面的資料都是成對出現的,如下圖 每一對中的第乙個值稱之為關鍵字 key 每個關鍵字只能在map中出現一次 第二個稱之為該關鍵字的對應值。標頭檔案 include map id name 使用 賦值是從c 11開始的,因此編譯器版本過低時會報錯,如visual s...