启动源服务
hive –service metastore
ss -nal 查看端口
CREATE TABLE student2(
id int,
name string,
sex string,
age int
)
row format delimited
fields terminated by ‘,’;
create table students(
student_name string ,
likes array,
address map
)
row format delimited
fields terminated by ‘,’
collection items terminated by ‘-‘
map keys terminated by ‘:’;
查看数据表结构
desc formatted students;
OK
# col_name data_type comment
student_name 服务器托管网 string
likes array
address map
# Detailed Table Information
Database: default
Owner: root
CreateTime: Fri Jul 17 10:15:34 EDT 2020
LastAccessTime: UNKNOWN
Retention: 0
Location: hdfs://mycluster/hive/warehouse/students
Table Type: MANAGED_TABLE
Table Parameters:
COLUMN_STATS_ACCURATE {“BASIC_STATS”:”true”}
numFiles 0
numRows 0
rawDataSize 0
totalSize 0
transient_lastDdlTime 1594995334
# Storage Information
SerDe Library: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat: org.apache.hadoop.mapred.TextInputForm服务器托管网at
OutputFormat: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Compressed: No
Num Buckets: -1
Bucket Columns: []
Sort Columns: []
Storage Desc Params:
colelction.delim –
field.delim ,
mapkey.delim :
serialization.format ,
Time taken: 0.136 seconds, Fetched: 35 row(s)
zhangsan,1-2-3,shanxi:shanxi-xian-yanta:luonan
zhangsan,1-2-3,shaaxi:shanxi-xian-yanta:luona
zhangsan,1-2-3,sichuan:shanxi-xian-yanta:luona
zhangsan,1-2-3,henan:shanxi-xian-yanta:luona
zhangsan,1-2-3,hebei:shanxi-xian-yanta:luona
hive 默认的分割符
内部表和外部表的区别
内部表创建有默认存储位置,外部表需要指定路径
内部表删除元数据和数据,外部表只删除元数据,不删除数据
单 分区
create table students2(
student_name string ,
likes array,
address map
)
partitioned by (age int)
row format delimited
fields terminated by ‘,’
collection items terminated by ‘-‘
map keys terminated by ‘:’;
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: 数字化转型导师坚鹏:科技金融政策、案例及数字化营销
科技金融政策、案例及数字化营销 课程背景: 很多银行存在以下问题: 不清楚科技金融有哪些利好政策? 不知道科技金融有哪些成功案例? 不知道科技金融如何数字化营销? 课程特色: 以案例的方式解读原创方法论 以互动的方式增强学员获得感 以咨询的方式提高培训实效性 …