hive总结

启动源服务

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<string>,

address map<string,string>

)

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<string>

address map<string,string>

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.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 ,

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<string>,

address map<string,string>

)

partitioned by (age int)

row format delimited

fields terminated by ','

collection items terminated by '-'

map keys terminated by ':';

相关推荐
知初~2 小时前
出行项目案例
hive·hadoop·redis·sql·mysql·spark·database
专注API从业者1 天前
分布式电商系统中的API网关架构设计
大数据·数据仓库·分布式·架构
我要用代码向我喜欢的女孩表白1 天前
hive迁移补数脚本细粒度 表名-分区唯一键
数据仓库·hive·hadoop
隔壁老登1 天前
查询hive指定数据库下所有表的建表语句并生成数据字典
数据库·hive·hadoop
人类群星闪耀时3 天前
数据湖与数据仓库:初学者的指南
大数据·数据仓库·spark
一张假钞3 天前
MapReduce 读取 Hive ORC ArrayIndexOutOfBoundsException: 1024 异常解决
大数据·hive·mapreduce
python资深爱好者3 天前
Hive中的分区和桶的概念及其作用
数据仓库·hive·hadoop
Beekeeper&&P...3 天前
Spring Security,servlet filter,和白名单之间的关系
hive·spring·servlet
我要用代码向我喜欢的女孩表白3 天前
hive(hdfs)补数脚本
数据仓库·hive·hadoop
宝哥大数据4 天前
Hive--map join
hive