网站制作的评价标准,开网站建设公司,oa网站模板,今天的热搜榜概述
管理表#xff0c;也称作内部表,受控表。 所有的 Table 数据#xff08;不包括 External Table#xff09;都保存在warehouse这个目录中。 删除表时#xff0c;元数据与数据都会被删除。 在加载数据的过程中#xff0c;实际数据会被移动到数据仓库目录中#xff1b…
概述
管理表也称作内部表,受控表。 所有的 Table 数据不包括 External Table都保存在warehouse这个目录中。 删除表时元数据与数据都会被删除。 在加载数据的过程中实际数据会被移动到数据仓库目录中之后对数据对访问将会直接在数据仓库目录中完成。删除表时表中的数据和元数据将会被同时删除。 操作
创建数据文件
inner_table.dat 创建表 hivecreate table inner_table (key string); 加载数据 hiveload data local inpath /root/inner_table.dat into table inner_table; 查看数据 select * from inner_table select count(*) from inner_table 删除表 drop table inner_table 缺点
假设t1表的文件路径在/home t2表的文件路径在/home/t2 当删除t1表时会把/home下的都删了。这是很危险的所以实际开发中不用管理表很容易导致数据丢失。 修改管理表为外部表 alter table t1 set tblpropertise(EXTERNALTRUE); EXTERNALTRUE 这个词必须大写改回内部表用FALSE ---------------------------------------------------------------
hive (default) desc formatted map_test; OK col_name data_type comment # col_name data_type comment id string perf mapstring,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)