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 ':';

相关推荐
AllData公司负责人21 小时前
AllData数据中台通过集成开源项目Apache IOTDB Web相关项目,建设物联网数据库平台
数据仓库·物联网·时序数据库·iotdb·工业物联网·apache iotdb·物联网数据库平台
Leo.yuan21 小时前
数据仓库是什么?数据仓库和BI有什么区别?
数据仓库
heimeiyingwang2 天前
【架构实战】ETL架构演进:从批处理到实时流处理
数据仓库·架构·etl
素玥2 天前
实训4 ETL构建中间层
数据仓库·etl
苛子2 天前
ETL与ELT的区别与选择:企业数据集成方案深度对比
数据仓库·etl
清水白石0082 天前
Python 日志采集到数据仓库 ETL 流程设计实战:从基础语法到生产级可靠运维
数据仓库·python·etl
2501_933329552 天前
企业舆情处置系统设计与实践:Infoseek数字公关AI中台技术解析
数据仓库·人工智能·重构·架构·数据库开发
莫叫石榴姐3 天前
字节广告数开一面 | 实习
大数据·数据仓库·面试
2501_933329553 天前
AI驱动媒介宣发:Infoseek舆情系统的技术架构与公关实战
数据仓库·人工智能·重构·数据库开发
heimeiyingwang3 天前
【架构实战】数据仓库分层架构(ODS/DWD/DWS/ADS)
数据仓库·架构