建立Hive外部表,關聯HDFS檔案

2021-09-26 09:19:07 字數 437 閱讀 4266

適用於hdfs中存放結構化資料的場景,

先建一張外部表

`id` string comment '包含wimei、wuser、telep、dimei和idfa',

`ffaid` string comment 'ffaid***',

`timestamp` string comment '時間戳,用於聚合3-90d粒度資料')

partitioned by (

`dt` string comment '日期yyyymmdd')

row format delimited

fields terminated by '\t';

然後關聯hdfs資料

這樣就將hdfs上的結構化資料,匯入外部表,可以直接通過sql語句來查詢。

ps:建外部表,關聯hdfs檔案也有其他方式,但測試後發現這種方式最靠譜。

Hive建立外部表

hive建立外部表 1.環境需求 hadoop 2.6.0 hive 1.2.1 hue 3.7.0 2.開發過程 1 建立hdfs目錄 hadoop dfs mkdir wy input 2 上傳本地資料到hdfs中 hadoop dfs put usr wy writing.txt wy inp...

HIVE建立外部表

基礎建表語句 create external table if not exists table name col name data type comment col comment comment table comment partitioned by col name data type c...

hive 外部表 建立示例

hdfs dfs mkdir p external sr sr created hdfs dfs mkdir p external sr sr assign hdfs dfs mkdir p external sr sr cancelled hdfs dfs mkdir p external sr ...