日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Hive的数据模型-管理表

發(fā)布時(shí)間:2025/3/11 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Hive的数据模型-管理表 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.


概述

管理表,也稱作內(nèi)部表,受控表。
所有的 Table 數(shù)據(jù)(不包括 External Table)都保存在warehouse這個(gè)目錄中。
刪除表時(shí),元數(shù)據(jù)與數(shù)據(jù)都會(huì)被刪除。
在加載數(shù)據(jù)的過程中,實(shí)際數(shù)據(jù)會(huì)被移動(dòng)到數(shù)據(jù)倉庫目錄中;之后對(duì)數(shù)據(jù)對(duì)訪問將會(huì)直接在數(shù)據(jù)倉庫目錄中完成。刪除表時(shí),表中的數(shù)據(jù)和元數(shù)據(jù)將會(huì)被同時(shí)刪除。


操作

創(chuàng)建數(shù)據(jù)文件

inner_table.dat


創(chuàng)建表
hive>create table inner_table (key string);


加載數(shù)據(jù)
hive>load data local inpath '/root/inner_table.dat' into table inner_table;


查看數(shù)據(jù)
select * from inner_table
select count(*) from inner_table


刪除表 drop table inner_table


缺點(diǎn)

假設(shè),t1表的文件路徑在/home
t2表的文件路徑在/home/t2
當(dāng)刪除t1表時(shí),會(huì)把/home下的都刪了。這是很危險(xiǎn)的,所以實(shí)際開發(fā)中,不用管理表,很容易導(dǎo)致數(shù)據(jù)丟失。


修改管理表為外部表
alter table t1 set tblpropertise('EXTERNAL'='TRUE');
?EXTERNAL,TRUE 這個(gè)詞必須大寫,改回內(nèi)部表用FALSE



---------------------------------------------------------------

hive (default)> desc formatted map_test;
OK
col_name ? ? ? ?data_type ? ? ? comment
# col_name ? ? ? ? ? ? ?data_type ? ? ? ? ? ? ? comment ? ? ? ? ? ??
? ? ? ? ? ? ? ? ?
id ? ? ? ? ? ? ? ? ? ? ?string ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
perf ? ? ? ? ? ? ? ? ? ?map<string,int> ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ?
# Detailed Table Information ? ? ? ? ? ??
Database: ? ? ? ? ? ? ? default ? ? ? ? ? ? ? ? ?
Owner: ? ? ? ? ? ? ? ? ?hadoop ? ? ? ? ? ? ? ? ??
CreateTime: ? ? ? ? ? ? Wed Aug 31 20:15:40 CST 2016 ? ??
LastAccessTime: ? ? ? ? UNKNOWN ? ? ? ? ? ? ? ? ?
Retention: ? ? ? ? ? ? ?0 ? ? ? ? ? ? ? ? ? ? ? ?
Location: ? ? ? ? ? ? ? hdfs://hello110:9000/user/hive/warehouse/map_test ? ? ? ?
Table Type: ? ? ? ? ? ? MANAGED_TABLE ? ? ? ? ? ?
Table Parameters: ? ? ? ? ? ? ? ?
? ? ? ? COLUMN_STATS_ACCURATE ? {\"BASIC_STATS\":\"true\"}
? ? ? ? numFiles ? ? ? ? ? ? ? ?0 ? ? ? ? ? ? ? ? ??
? ? ? ? numRows ? ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? ? ??
? ? ? ? rawDataSize ? ? ? ? ? ? 0 ? ? ? ? ? ? ? ? ??
? ? ? ? totalSize ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? ? ??
? ? ? ? transient_lastDdlTime ? 1472645800 ? ? ? ? ?
? ? ? ? ? ? ? ? ?
# Storage Information ? ? ? ? ? ?
SerDe Library: ? ? ? ? ?org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe ? ? ??
InputFormat: ? ? ? ? ? ?org.apache.hadoop.mapred.TextInputFormat ? ? ? ??
OutputFormat: ? ? ? ? ? org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat ? ? ??
Compressed: ? ? ? ? ? ? No ? ? ? ? ? ? ? ? ? ? ??
Num Buckets: ? ? ? ? ? ?-1 ? ? ? ? ? ? ? ? ? ? ??
Bucket Columns: ? ? ? ? [] ? ? ? ? ? ? ? ? ? ? ??
Sort Columns: ? ? ? ? ? [] ? ? ? ? ? ? ? ? ? ? ??
Storage Desc Params: ? ? ? ? ? ??
? ? ? ? colelction.delim ? ? ? ?, ? ? ? ? ? ? ? ? ??
? ? ? ? field.delim ? ? ? ? ? ? \t ? ? ? ? ? ? ? ? ?
? ? ? ? mapkey.delim ? ? ? ? ? ?: ? ? ? ? ? ? ? ? ??
? ? ? ? serialization.format ? ?\t ? ? ? ? ? ? ? ? ?
Time taken: 0.383 seconds, Fetched: 34 row(s)




總結(jié)

以上是生活随笔為你收集整理的Hive的数据模型-管理表的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。