hive函數大全:https://www.cnblogs.com/MOBIN/p/5618747.html
1.查看錶結構
show create table tablename;
2.查看視圖
show create view viewname;
3.查看分區
show partitions tablename;
4.提取json內容
get_json_object(json_data,'$.name')
5.替換
regexp_replace(name,',','')
6.正則匹配函數
語法:regexp_extract(string subject, string pattern, int index)
返回值: string
說明: 將字符串subject按照pattern正則表達式的規則拆分,返回index指定的字符。
第一參數: 要處理的字段
第二參數: 需要匹配的正則表達式
第三個參數:
0 是顯示與之匹配的整個字符串
1 是顯示第一個括號裏面的
2 是顯示第二個括號裏面的字段
參考:https://blog.csdn.net/jv_rookie/article/details/55211955
7.添加分區
create external table tmp.tmp_user(
id decimal(30)
,json_data string
)
partitioned by (dt string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
location '/tmp/user'
stored as orc
;
alter table tmp.tmp_user add partition(dt=20181201) location '/user/info/user/20181201.tsv';
8.